parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function c(e,t){return v(e)||f(e,t)||d(e,t)||h()}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n3?(r=f===i)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((r=n<2&&pi||i>f)&&(a[4]=n,a[5]=i,d.n=f,s=0))}if(r||n>1)return o;throw h=!0,i}return function(r,c,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,u=f;(t=s<2?e:u)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,u)):d.n=u:d.v=u);try{if(l=2,a){if(s||(r="next"),t=a[r]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+r+"' method"),s=1);a=e}else if((t=(h=d.n<0)?u:n.call(i,d))!==o)break}catch(t){a=e,s=1,u=t}finally{l=1}}return{value:t,done:h}}}(n,r,a),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(k(t={},i,function(){return this}),t),h=l.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,k(e,r,"GeneratorFunction")),e.prototype=Object.create(h),e}return u.prototype=l,k(h,"constructor",l),k(l,"constructor",u),u.displayName="GeneratorFunction",k(l,r,"GeneratorFunction"),k(h),k(h,r,"Generator"),k(h,i,function(){return this}),k(h,"toString",function(){return"[object Generator]"}),(E=function(){return{w:a,m:d}})()}function k(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}(k=function(e,t,n,i){if(t)r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n;else{function a(t,n){k(e,t,function(e){return this._invoke(t,n,e)})}a("next",0),a("throw",1),a("return",2)}})(e,t,n,i)}function C(e){throw new TypeError('"'+e+'" is read-only')}function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){for(var n=0;n>8&255]+$n[e>>16&255]+$n[e>>24&255]+"-"+$n[255&t]+$n[t>>8&255]+"-"+$n[t>>16&15|64]+$n[t>>24&255]+"-"+$n[63&n|128]+$n[n>>8&255]+"-"+$n[n>>16&255]+$n[n>>24&255]+$n[255&i]+$n[i>>8&255]+$n[i>>16&255]+$n[i>>24&255]).toLowerCase()}function ri(e,t,n){return Math.max(t,Math.min(n,e))}function ai(e,t){return(e%t+t)%t}function oi(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)}function si(e,t,n){return e!==t?(n-e)/(t-e):0}function ui(e,t,n){return(1-n)*e+n*t}function li(e,t,n,i){return ui(e,t,1-Math.exp(-n*i))}function ci(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(ai(e,2*t)-t)}function hi(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)}function di(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)}function pi(e,t){return e+Math.floor(Math.random()*(t-e+1))}function fi(e,t){return e+Math.random()*(t-e)}function vi(e){return e*(.5-Math.random())}function mi(e){void 0!==e&&(ei=e);var t=ei+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}function gi(e){return e*ti}function yi(e){return e*ni}function xi(e){return 0==(e&e-1)&&0!==e}function _i(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Mi(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function bi(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),u=o(n/2),l=a((t+i)/2),c=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*c,u*h,u*d,s*l);break;case"YZY":e.set(u*d,s*c,u*h,s*l);break;case"ZXZ":e.set(u*h,u*d,s*c,s*l);break;case"XZX":e.set(s*c,u*f,u*p,s*l);break;case"YXY":e.set(u*p,s*c,u*f,s*l);break;case"ZYZ":e.set(u*f,u*p,s*c,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Si(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function wi(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var Ti=exports.MathUtils={DEG2RAD:ti,RAD2DEG:ni,generateUUID:ii,clamp:ri,euclideanModulo:ai,mapLinear:oi,inverseLerp:si,lerp:ui,damp:li,pingpong:ci,smoothstep:hi,smootherstep:di,randInt:pi,randFloat:fi,randFloatSpread:vi,seededRandom:mi,degToRad:gi,radToDeg:yi,isPowerOfTwo:xi,ceilPowerOfTwo:_i,floorPowerOfTwo:Mi,setQuaternionFromProperEuler:bi,normalize:wi,denormalize:Si},Ai=exports.Vector2=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(this,e),e.prototype.isVector2=!0,this.x=t,this.y=n},[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(ri(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:E().m(function e(){return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.x;case 1:return e.n=2,this.y;case 2:return e.a(2)}},e,this)})}])}(),Ei=exports.Matrix3=function(){return I(function e(){R(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]},[{key:"set",value:function(e,t,n,i,r,a,o,s,u){var l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=a,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],u=n[1],l=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=i[0],v=i[3],m=i[6],g=i[1],y=i[4],x=i[7],_=i[2],M=i[5],b=i[8];return r[0]=a*f+o*g+s*_,r[3]=a*v+o*y+s*M,r[6]=a*m+o*x+s*b,r[1]=u*f+l*g+c*_,r[4]=u*v+l*y+c*M,r[7]=u*m+l*x+c*b,r[2]=h*f+d*g+p*_,r[5]=h*v+d*y+p*M,r[8]=h*m+d*x+p*b,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8];return t*a*l-t*o*u-n*r*l+n*o*s+i*r*u-i*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=l*a-o*u,h=o*s-l*r,d=u*r-a*s,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return e[0]=c*f,e[1]=(i*u-l*n)*f,e[2]=(o*n-i*a)*f,e[3]=h*f,e[4]=(l*t-i*s)*f,e[5]=(i*r-o*t)*f,e[6]=d*f,e[7]=(n*s-u*t)*f,e[8]=(a*t-n*r)*f,this}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},{key:"setUvTransform",value:function(e,t,n,i,r,a,o){var s=Math.cos(r),u=Math.sin(r);return this.set(n*s,n*u,-n*(s*a+u*o)+a+e,-i*u,i*s,-i*(-u*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(ki.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(ki.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(ki.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}])}(),ki=new Ei;function Ci(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var Li={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ri(e,t){return new Li[e](t)}function Pi(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ii(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Di(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Ui=(new Ei).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Ni=(new Ei).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Oi(e){return e.convertSRGBToLinear().applyMatrix3(Ni)}function zi(e){return e.applyMatrix3(Ui).convertLinearToSRGB()}var Bi,Fi=A(A(A({},bn,function(e){return e}),Mn,function(e){return e.convertSRGBToLinear()}),Sn,Oi),Gi=A(A(A({},bn,function(e){return e}),Mn,function(e){return e.convertLinearToSRGB()}),Sn,zi),Vi=exports.ColorManagement={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return bn},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;var i=Fi[t],r=Gi[n];if(void 0===i||void 0===r)throw new Error('Unsupported color space conversion, "'.concat(t,'" to "').concat(n,'".'));return r(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Hi=exports.ImageUtils=function(){return I(function e(){R(this,e)},null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Bi&&(Bi=Pi("canvas")),Bi.width=e.width,Bi.height=e.height;var n=Bi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Bi}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Pi("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var i=n.getImageData(0,0,e.width,e.height),r=i.data,a=0;a0&&void 0!==arguments[0]?arguments[0]:null;R(this,e),this.isSource=!0,this.uuid=ii(),this.data=t,this.version=0},[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},i=this.data;if(null!==i){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a0&&void 0!==arguments[0]?arguments[0]:t.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.DEFAULT_MAPPING,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:He,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:He,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Je,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:$e,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:pt,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:tt,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:t.DEFAULT_ANISOTROPY,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:fn;return R(this,t),(e=x(this,t)).isTexture=!0,Object.defineProperty(e,"id",{value:qi++}),e.uuid=ii(),e.name="",e.source=new Wi(n),e.mipmaps=[],e.mapping=i,e.channel=0,e.wrapS=r,e.wrapT=a,e.magFilter=o,e.minFilter=s,e.anisotropy=c,e.format=u,e.internalFormat=null,e.type=l,e.offset=new Ai(0,0),e.repeat=new Ai(1,1),e.center=new Ai(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new Ei,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.encoding=h,e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return w(t,Qn),I(t,[{key:"image",get:function(){return this.source.data},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==Ne)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ve:e.x=e.x-Math.floor(e.x);break;case He:e.x=e.x<0?0:1;break;case We:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Ve:e.y=e.y-Math.floor(e.y);break;case He:e.y=e.y<0?0:1;break;case We:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}])}();Xi.DEFAULT_IMAGE=null,Xi.DEFAULT_MAPPING=Ne,Xi.DEFAULT_ANISOTROPY=1;var Yi=exports.Vector4=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;R(this,e),e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=i,this.w=r},[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],u=a[8],l=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(u-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(u+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var v=(o+1)/2,m=(c+1)/2,g=(f+1)/2,y=(s+l)/4,x=(u+d)/4,_=(h+p)/4;return v>m&&v>g?v<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(v)),r=x/n):m>g?m<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(m)),r=_/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(g)),i=_/r),this.set(n,i,r,t),this}var M=Math.sqrt((p-h)*(p-h)+(u-d)*(u-d)+(l-s)*(l-s));return Math.abs(M)<.001&&(M=1),this.x=(p-h)/M,this.y=(u-d)/M,this.z=(l-s)/M,this.w=Math.acos((o+c+f-1)/2),this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:E().m(function e(){return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.x;case 1:return e.n=2,this.y;case 2:return e.n=3,this.z;case 3:return e.n=4,this.w;case 4:return e.a(2)}},e,this)})}])}(),Zi=exports.WebGLRenderTarget=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};R(this,t),(e=x(this,t)).isWebGLRenderTarget=!0,e.width=n,e.height=i,e.depth=1,e.scissor=new Yi(0,0,n,i),e.scissorTest=!1,e.viewport=new Yi(0,0,n,i);var a={width:n,height:i,depth:1};return e.texture=new Xi(a,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),e.texture.isRenderTargetTexture=!0,e.texture.flipY=!1,e.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,e.texture.internalFormat=void 0!==r.internalFormat?r.internalFormat:null,e.texture.minFilter=void 0!==r.minFilter?r.minFilter:Je,e.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,e.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,e.depthTexture=void 0!==r.depthTexture?r.depthTexture:null,e.samples=void 0!==r.samples?r.samples:0,e}return w(t,Qn),I(t,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new Wi(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}])}(),Ji=exports.DataArrayTexture=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return R(this,t),(e=x(this,t,[null])).isDataArrayTexture=!0,e.image={data:n,width:i,height:r,depth:a},e.magFilter=je,e.minFilter=je,e.wrapR=He,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return w(t,Xi),I(t)}(),Ki=exports.WebGLArrayRenderTarget=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return R(this,t),(e=x(this,t,[n,i])).isWebGLArrayRenderTarget=!0,e.depth=r,e.texture=new Ji(null,n,i,r),e.texture.isRenderTargetTexture=!0,e}return w(t,Zi),I(t)}(),Qi=exports.Data3DTexture=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return R(this,t),(e=x(this,t,[null])).isData3DTexture=!0,e.image={data:n,width:i,height:r,depth:a},e.magFilter=je,e.minFilter=je,e.wrapR=He,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return w(t,Xi),I(t)}(),$i=exports.WebGL3DRenderTarget=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return R(this,t),(e=x(this,t,[n,i])).isWebGL3DRenderTarget=!0,e.depth=r,e.texture=new Qi(null,n,i,r),e.texture.isRenderTargetTexture=!0,e}return w(t,Zi),I(t)}(),er=exports.WebGLMultipleRenderTargets=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};R(this,t),(e=x(this,t,[n,i,a])).isWebGLMultipleRenderTargets=!0;var o=e.texture;e.texture=[];for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var i=0,r=this.texture.length;i0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;R(this,e),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=r},[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,u=o(n/2),l=o(i/2),c=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);switch(a){case"XYZ":this._x=h*l*c+u*d*p,this._y=u*d*c-h*l*p,this._z=u*l*p+h*d*c,this._w=u*l*c-h*d*p;break;case"YXZ":this._x=h*l*c+u*d*p,this._y=u*d*c-h*l*p,this._z=u*l*p-h*d*c,this._w=u*l*c+h*d*p;break;case"ZXY":this._x=h*l*c-u*d*p,this._y=u*d*c+h*l*p,this._z=u*l*p+h*d*c,this._w=u*l*c-h*d*p;break;case"ZYX":this._x=h*l*c-u*d*p,this._y=u*d*c+h*l*p,this._z=u*l*p-h*d*c,this._w=u*l*c+h*d*p;break;case"YZX":this._x=h*l*c+u*d*p,this._y=u*d*c+h*l*p,this._z=u*l*p-h*d*c,this._w=u*l*c-h*d*p;break;case"XZY":this._x=h*l*c-u*d*p,this._y=u*d*c-h*l*p,this._z=u*l*p+h*d*c,this._w=u*l*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],u=t[2],l=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(l-s)*d,this._y=(r-u)*d,this._z=(a-i)*d}else if(n>o&&n>c){var p=2*Math.sqrt(1+n-o-c);this._w=(l-s)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+u)/p}else if(o>c){var f=2*Math.sqrt(1+o-n-c);this._w=(r-u)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(s+l)/f}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-i)/v,this._x=(r+u)/v,this._y=(s+l)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(ri(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,u=t._z,l=t._w;return this._x=n*l+a*o+i*u-r*s,this._y=i*l+a*s+r*o-n*u,this._z=r*l+a*u+n*s-i*o,this._w=a*l-n*o-i*s-r*u,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-t;return this._w=u*a+t*this._w,this._x=u*n+t*this._x,this._y=u*i+t*this._y,this._z=u*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"toJSON",value:function(){return this.toArray()}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:E().m(function e(){return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._x;case 1:return e.n=2,this._y;case 2:return e.n=3,this._z;case 3:return e.n=4,this._w;case 4:return e.a(2)}},e,this)})}],[{key:"slerpFlat",value:function(e,t,n,i,r,a,o){var s=n[i+0],u=n[i+1],l=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=u,e[t+2]=l,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=f);if(c!==f||s!==h||u!==d||l!==p){var v=1-o,m=s*h+u*d+l*p+c*f,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,m*g);v=Math.sin(v*_)/x,o=Math.sin(o*_)/x}var M=o*g;if(s=s*v+h*M,u=u*v+d*M,l=l*v+p*M,c=c*v+f*M,v===1-o){var b=1/Math.sqrt(s*s+u*u+l*l+c*c);s*=b,u*=b,l*=b,c*=b}}e[t]=s,e[t+1]=u,e[t+2]=l,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],u=n[i+2],l=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=o*p+l*c+s*d-u*h,e[t+1]=s*p+l*h+u*c-o*d,e[t+2]=u*p+l*d+o*h-s*c,e[t+3]=l*p-o*c-s*h-u*d,e}}])}(),nr=exports.Vector3=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;R(this,e),e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=i},[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(rr.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(rr.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,u=s*t+a*i-o*n,l=s*n+o*t-r*i,c=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=u*s+h*-r+l*-o-c*-a,this.y=l*s+h*-a+c*-r-u*-o,this.z=c*s+h*-o+u*-a-l*-r,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return ir.copy(this).projectOnVector(e),this.sub(ir)}},{key:"reflect",value:function(e){return this.sub(ir.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(ri(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"setFromColor",value:function(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:E().m(function e(){return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.x;case 1:return e.n=2,this.y;case 2:return e.n=3,this.z;case 3:return e.a(2)}},e,this)})}])}(),ir=new nr,rr=new tr,ar=exports.Box3=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr(-1/0,-1/0,-1/0);R(this,e),this.isBox3=!0,this.min=t,this.max=n},[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];if(e.updateWorldMatrix(!1,!1),void 0!==e.boundingBox)null===e.boundingBox&&e.computeBoundingBox(),ur.copy(e.boundingBox),ur.applyMatrix4(e.matrixWorld),this.union(ur);else{var n=e.geometry;if(void 0!==n)if(t&&void 0!==n.attributes&&void 0!==n.attributes.position)for(var i=n.attributes.position,r=0,a=i.count;rthis.max.x||e.ythis.max.y||e.zthis.max.z)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,sr),sr.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(vr),mr.subVectors(this.max,vr),lr.subVectors(e.a,vr),cr.subVectors(e.b,vr),hr.subVectors(e.c,vr),dr.subVectors(cr,lr),pr.subVectors(hr,cr),fr.subVectors(lr,hr);var t=[0,-dr.z,dr.y,0,-pr.z,pr.y,0,-fr.z,fr.y,dr.z,0,-dr.x,pr.z,0,-pr.x,fr.z,0,-fr.x,-dr.y,dr.x,0,-pr.y,pr.x,0,-fr.y,fr.x,0];return!!xr(t,lr,cr,hr,mr)&&(!!xr(t=[1,0,0,0,1,0,0,0,1],lr,cr,hr,mr)&&(gr.crossVectors(dr,pr),xr(t=[gr.x,gr.y,gr.z],lr,cr,hr,mr)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,sr).distanceTo(e)}},{key:"getBoundingSphere",value:function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(sr).length()),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()?this:(or[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),or[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),or[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),or[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),or[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),or[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),or[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),or[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(or),this)}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}])}(),or=[new nr,new nr,new nr,new nr,new nr,new nr,new nr,new nr],sr=new nr,ur=new ar,lr=new nr,cr=new nr,hr=new nr,dr=new nr,pr=new nr,fr=new nr,vr=new nr,mr=new nr,gr=new nr,yr=new nr;function xr(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){yr.fromArray(e,a);var s=r.x*Math.abs(yr.x)+r.y*Math.abs(yr.y)+r.z*Math.abs(yr.z),u=t.dot(yr),l=n.dot(yr),c=i.dot(yr);if(Math.max(-Math.max(u,l,c),Math.min(u,l,c))>s)return!1}return!0}var _r=new ar,Mr=new nr,br=new nr,Sr=exports.Sphere=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;R(this,e),this.center=t,this.radius=n},[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):_r.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Mr.subVectors(e,this.center);var t=Mr.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),i=.5*(n-this.radius);this.center.addScaledVector(Mr,i/n),this.radius+=i}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(br.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Mr.copy(e.center).add(br)),this.expandByPoint(Mr.copy(e.center).sub(br))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),wr=new nr,Tr=new nr,Ar=new nr,Er=new nr,kr=new nr,Cr=new nr,Lr=new nr,Rr=exports.Ray=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr(0,0,-1);R(this,e),this.origin=t,this.direction=n},[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,wr)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=wr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(wr.copy(this.origin).addScaledVector(this.direction,t),wr.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,i){Tr.copy(e).add(t).multiplyScalar(.5),Ar.copy(t).sub(e).normalize(),Er.copy(this.origin).sub(Tr);var r,a,o,s,u=.5*e.distanceTo(t),l=-this.direction.dot(Ar),c=Er.dot(this.direction),h=-Er.dot(Ar),d=Er.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*c-h,s=u*p,(r=l*h-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+l*(a*=f)+2*c)+a*(l*r+a+2*h)+d}else a=u,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*h)+d;else a=-u,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-l*u+c)))*r+(a=r>0?-u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-u,-h),u))*(a+2*h)+d):o=-(r=Math.max(0,-(l*u+c)))*r+(a=r>0?u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d;else a=l>0?-u:u,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(Tr).addScaledVector(Ar,a),o}},{key:"intersectSphere",value:function(e,t){wr.subVectors(e.center,this.origin);var n=wr.dot(this.direction),i=wr.dot(wr)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,i,r,a,o,s,u=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,i=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,i=(e.min.x-h.x)*u),l>=0?(r=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(r=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s=0?n:i,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,wr)}},{key:"intersectTriangle",value:function(e,t,n,i,r){kr.subVectors(t,e),Cr.subVectors(n,e),Lr.crossVectors(kr,Cr);var a,o=this.direction.dot(Lr);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Er.subVectors(this.origin,e);var s=a*this.direction.dot(Cr.crossVectors(Er,Cr));if(s<0)return null;var u=a*this.direction.dot(kr.cross(Er));if(u<0)return null;if(s+u>o)return null;var l=-a*Er.dot(Lr);return l<0?null:this.at(l/o,r)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),Pr=exports.Matrix4=function(){function e(){R(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}return I(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,u,l,c,h,d,p,f,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=u,m[6]=l,m[10]=c,m[14]=h,m[3]=d,m[7]=p,m[11]=f,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,i=1/Ir.setFromMatrixColumn(e,0).length(),r=1/Ir.setFromMatrixColumn(e,1).length(),a=1/Ir.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),u=Math.sin(i),l=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var h=a*l,d=a*c,p=o*l,f=o*c;t[0]=s*l,t[4]=-s*c,t[8]=u,t[1]=d+p*u,t[5]=h-f*u,t[9]=-o*s,t[2]=f-h*u,t[6]=p+d*u,t[10]=a*s}else if("YXZ"===e.order){var v=s*l,m=s*c,g=u*l,y=u*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*u,t[1]=a*c,t[5]=a*l,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var x=s*l,_=s*c,M=u*l,b=u*c;t[0]=x-b*o,t[4]=-a*c,t[8]=M+_*o,t[1]=_+M*o,t[5]=a*l,t[9]=b-x*o,t[2]=-a*u,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var S=a*l,w=a*c,T=o*l,A=o*c;t[0]=s*l,t[4]=T*u-w,t[8]=S*u+A,t[1]=s*c,t[5]=A*u+S,t[9]=w*u-T,t[2]=-u,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var E=a*s,k=a*u,C=o*s,L=o*u;t[0]=s*l,t[4]=L-E*c,t[8]=C*c+k,t[1]=c,t[5]=a*l,t[9]=-o*l,t[2]=-u*l,t[6]=k*c+C,t[10]=E-L*c}else if("XZY"===e.order){var R=a*s,P=a*u,I=o*s,D=o*u;t[0]=s*l,t[4]=-c,t[8]=u*l,t[1]=R*c+D,t[5]=a*l,t[9]=P*c-I,t[2]=I*c-P,t[6]=o*l,t[10]=D*c+R}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Ur,e,Nr)}},{key:"lookAt",value:function(e,t,n){var i=this.elements;return Br.subVectors(e,t),0===Br.lengthSq()&&(Br.z=1),Br.normalize(),Or.crossVectors(n,Br),0===Or.lengthSq()&&(1===Math.abs(n.z)?Br.x+=1e-4:Br.z+=1e-4,Br.normalize(),Or.crossVectors(n,Br)),Or.normalize(),zr.crossVectors(Br,Or),i[0]=Or.x,i[4]=zr.x,i[8]=Br.x,i[1]=Or.y,i[5]=zr.y,i[9]=Br.y,i[2]=Or.z,i[6]=zr.z,i[10]=Br.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],u=n[12],l=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],v=n[10],m=n[14],g=n[3],y=n[7],x=n[11],_=n[15],M=i[0],b=i[4],S=i[8],w=i[12],T=i[1],A=i[5],E=i[9],k=i[13],C=i[2],L=i[6],R=i[10],P=i[14],I=i[3],D=i[7],U=i[11],N=i[15];return r[0]=a*M+o*T+s*C+u*I,r[4]=a*b+o*A+s*L+u*D,r[8]=a*S+o*E+s*R+u*U,r[12]=a*w+o*k+s*P+u*N,r[1]=l*M+c*T+h*C+d*I,r[5]=l*b+c*A+h*L+d*D,r[9]=l*S+c*E+h*R+d*U,r[13]=l*w+c*k+h*P+d*N,r[2]=p*M+f*T+v*C+m*I,r[6]=p*b+f*A+v*L+m*D,r[10]=p*S+f*E+v*R+m*U,r[14]=p*w+f*k+v*P+m*N,r[3]=g*M+y*T+x*C+_*I,r[7]=g*b+y*A+x*L+_*D,r[11]=g*S+y*E+x*R+_*U,r[15]=g*w+y*k+x*P+_*N,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],u=e[13],l=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+r*s*c-i*u*c-r*o*h+n*u*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*u*h+r*a*h-i*a*d+i*u*l-r*s*l)+e[11]*(+t*u*c-t*o*d-r*a*c+n*a*d+r*o*l-n*u*l)+e[15]*(-i*o*l-t*s*c+t*o*h+i*a*c-n*a*h+n*s*l)}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{key:"setPosition",value:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],v=e[14],m=e[15],g=c*v*u-f*h*u+f*s*d-o*v*d-c*s*m+o*h*m,y=p*h*u-l*v*u-p*s*d+a*v*d+l*s*m-a*h*m,x=l*f*u-p*c*u+p*o*d-a*f*d-l*o*m+a*c*m,_=p*c*s-l*f*s-p*o*h+a*f*h+l*o*v-a*c*v,M=t*g+n*y+i*x+r*_;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var b=1/M;return e[0]=g*b,e[1]=(f*h*r-c*v*r-f*i*d+n*v*d+c*i*m-n*h*m)*b,e[2]=(o*v*r-f*s*r+f*i*u-n*v*u-o*i*m+n*s*m)*b,e[3]=(c*s*r-o*h*r-c*i*u+n*h*u+o*i*d-n*s*d)*b,e[4]=y*b,e[5]=(l*v*r-p*h*r+p*i*d-t*v*d-l*i*m+t*h*m)*b,e[6]=(p*s*r-a*v*r-p*i*u+t*v*u+a*i*m-t*s*m)*b,e[7]=(a*h*r-l*s*r+l*i*u-t*h*u-a*i*d+t*s*d)*b,e[8]=x*b,e[9]=(p*c*r-l*f*r-p*n*d+t*f*d+l*n*m-t*c*m)*b,e[10]=(a*f*r-p*o*r+p*n*u-t*f*u-a*n*m+t*o*m)*b,e[11]=(l*o*r-a*c*r-l*n*u+t*c*u+a*n*d-t*o*d)*b,e[12]=_*b,e[13]=(l*f*i-p*c*i+p*n*h-t*f*h-l*n*v+t*c*v)*b,e[14]=(p*o*i-a*f*i-p*n*s+t*f*s+a*n*v-t*o*v)*b,e[15]=(a*c*i-l*o*i+l*n*s-t*c*s-a*n*h+t*o*h)*b,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}},{key:"makeTranslation",value:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,u=r*a,l=r*o;return this.set(u*a+n,u*o-i*s,u*s+i*o,0,u*o+i*s,l*o+n,l*s-i*a,0,u*s-i*o,l*s+i*a,r*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,u=r+r,l=a+a,c=o+o,h=r*u,d=r*l,p=r*c,f=a*l,v=a*c,m=o*c,g=s*u,y=s*l,x=s*c,_=n.x,M=n.y,b=n.z;return i[0]=(1-(f+m))*_,i[1]=(d+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(d-x)*M,i[5]=(1-(h+m))*M,i[6]=(v+g)*M,i[7]=0,i[8]=(p+y)*b,i[9]=(v-g)*b,i[10]=(1-(h+f))*b,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}},{key:"decompose",value:function(e,t,n){var i=this.elements,r=Ir.set(i[0],i[1],i[2]).length(),a=Ir.set(i[4],i[5],i[6]).length(),o=Ir.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Dr.copy(this);var s=1/r,u=1/a,l=1/o;return Dr.elements[0]*=s,Dr.elements[1]*=s,Dr.elements[2]*=s,Dr.elements[4]*=u,Dr.elements[5]*=u,Dr.elements[6]*=u,Dr.elements[8]*=l,Dr.elements[9]*=l,Dr.elements[10]*=l,t.setFromRotationMatrix(Dr),n.x=r,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,i,r,a){var o=this.elements,s=2*r/(t-e),u=2*r/(n-i),l=(t+e)/(t-e),c=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=u,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),u=1/(n-i),l=1/(a-r),c=(t+e)*s,h=(n+i)*u,d=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*u,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}])}(),Ir=new nr,Dr=new Pr,Ur=new nr(0,0,0),Nr=new nr(1,1,1),Or=new nr,zr=new nr,Br=new nr,Fr=new Pr,Gr=new tr,Vr=exports.Euler=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.DEFAULT_ORDER;R(this,e),this.isEuler=!0,this._x=t,this._y=n,this._z=i,this._order=r},[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],u=i[5],l=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(ri(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-ri(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(ri(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-ri(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(ri(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-ri(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Fr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Fr,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Gr.setFromEuler(this),this.setFromQuaternion(Gr,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:E().m(function e(){return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._x;case 1:return e.n=2,this._y;case 2:return e.n=3,this._z;case 3:return e.n=4,this._order;case 4:return e.a(2)}},e,this)})}])}();Vr.DEFAULT_ORDER="XYZ";var Hr=exports.Layers=function(){return I(function e(){R(this,e),this.mask=1},[{key:"set",value:function(e){this.mask=(1<>>0}},{key:"enable",value:function(e){this.mask|=1<1){for(var t=0;t1){for(var t=0;t0&&(n=n.concat(a))}return n}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zr,e,Jr),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zr,Kr,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,i=t.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,u=o.length;s0){i.children=[];for(var p=0;p0){i.animations=[];for(var f=0;f0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),M.length>0&&(n.skeletons=M),b.length>0&&(n.animations=b),S.length>0&&(n.nodes=S)}return n.object=i,n;function w(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:new nr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new nr;R(this,e),this.a=t,this.b=n,this.c=i}return I(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return ra.subVectors(this.c,this.b),aa.subVectors(this.a,this.b),.5*ra.cross(aa).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,i,r,a){return!1===fa&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),fa=!0),e.getInterpolation(t,this.a,this.b,this.c,n,i,r,a)}},{key:"getInterpolation",value:function(t,n,i,r,a){return e.getInterpolation(t,this.a,this.b,this.c,n,i,r,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,i,r=this.a,a=this.b,o=this.c;ua.subVectors(a,r),la.subVectors(o,r),ha.subVectors(e,r);var s=ua.dot(ha),u=la.dot(ha);if(s<=0&&u<=0)return t.copy(r);da.subVectors(e,a);var l=ua.dot(da),c=la.dot(da);if(l>=0&&c<=l)return t.copy(a);var h=s*c-l*u;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(r).addScaledVector(ua,n);pa.subVectors(e,o);var d=ua.dot(pa),p=la.dot(pa);if(p>=0&&d<=p)return t.copy(o);var f=d*u-s*p;if(f<=0&&u>=0&&p<=0)return i=u/(u-p),t.copy(r).addScaledVector(la,i);var v=l*p-d*c;if(v<=0&&c-l>=0&&d-p>=0)return ca.subVectors(o,a),i=(c-l)/(c-l+(d-p)),t.copy(a).addScaledVector(ca,i);var m=1/(v+f+h);return n=f*m,i=h*m,t.copy(r).addScaledVector(ua,n).addScaledVector(la,i)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,i){i.subVectors(n,t),ra.subVectors(e,t),i.cross(ra);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,i,r){ra.subVectors(i,t),aa.subVectors(n,t),oa.subVectors(e,t);var a=ra.dot(ra),o=ra.dot(aa),s=ra.dot(oa),u=aa.dot(aa),l=aa.dot(oa),c=a*u-o*o;if(0===c)return r.set(-2,-1,-1);var h=1/c,d=(u*s-o*l)*h,p=(a*l-o*s)*h;return r.set(1-d-p,p,d)}},{key:"containsPoint",value:function(e,t,n,i){return this.getBarycoord(e,t,n,i,sa),sa.x>=0&&sa.y>=0&&sa.x+sa.y<=1}},{key:"getUV",value:function(e,t,n,i,r,a,o,s){return!1===fa&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),fa=!0),this.getInterpolation(e,t,n,i,r,a,o,s)}},{key:"getInterpolation",value:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,sa),s.setScalar(0),s.addScaledVector(r,sa.x),s.addScaledVector(a,sa.y),s.addScaledVector(o,sa.z),s}},{key:"isFrontFacing",value:function(e,t,n,i){return ra.subVectors(n,t),aa.subVectors(e,t),ra.cross(aa).dot(i)<0}}])}(),ma=0,ga=exports.Material=function(e){function t(){var e;return R(this,t),(e=x(this,t)).isMaterial=!0,Object.defineProperty(e,"id",{value:ma++}),e.uuid=ii(),e.name="",e.type="Material",e.blending=Q,e.side=X,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=de,e.blendDst=pe,e.blendEquation=ie,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=be,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=Bn,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=Tn,e.stencilZFail=Tn,e.stencilZPass=Tn,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return w(t,Qn),I(t,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}else console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."))}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Q&&(n.blending=this.blending),this.side!==X&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}])}(),ya={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},xa={h:0,s:0,l:0},_a={h:0,s:0,l:0};function Ma(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var ba=exports.Color=function(){return I(function e(t,n,i){return R(this,e),this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===n&&void 0===i?this.set(t):this.setRGB(t,n,i)},[{key:"set",value:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mn;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Vi.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Vi.workingColorSpace;return this.r=e,this.g=t,this.b=n,Vi.toWorkingColorSpace(this,i),this}},{key:"setHSL",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Vi.workingColorSpace;if(e=ai(e,1),t=ri(t,0,1),n=ri(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=Ma(a,r,e+1/3),this.g=Ma(a,r,e),this.b=Ma(a,r,e-1/3)}return Vi.toWorkingColorSpace(this,i),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mn;function i(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){var r,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,Vi.toWorkingColorSpace(this,n),i(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,Vi.toWorkingColorSpace(this,n),i(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(r[1])/360,u=parseFloat(r[2])/100,l=parseFloat(r[3])/100;return i(r[4]),this.setHSL(s,u,l,n)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=t[1],h=c.length;if(3===h)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,n);if(6===h)return this.setHex(parseInt(c,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mn,n=ya[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=Ii(e.r),this.g=Ii(e.g),this.b=Ii(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=Di(e.r),this.g=Di(e.g),this.b=Di(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mn;return Vi.fromWorkingColorSpace(Sa.copy(this),e),ri(255*Sa.r,0,255)<<16^ri(255*Sa.g,0,255)<<8^ri(255*Sa.b,0,255)<<0}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mn;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vi.workingColorSpace;Vi.fromWorkingColorSpace(Sa.copy(this),t);var n,i,r=Sa.r,a=Sa.g,o=Sa.b,s=Math.max(r,a,o),u=Math.min(r,a,o),l=(u+s)/2;if(u===s)n=0,i=0;else{var c=s-u;switch(i=l<=.5?c/(s+u):c/(2-s-u),s){case r:n=(a-o)/c+(a1&&void 0!==arguments[1]?arguments[1]:Vi.workingColorSpace;return Vi.fromWorkingColorSpace(Sa.copy(this),t),e.r=Sa.r,e.g=Sa.g,e.b=Sa.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mn;Vi.fromWorkingColorSpace(Sa.copy(this),e);var t=Sa.r,n=Sa.g,i=Sa.b;return e!==Mn?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(255*t|0,",").concat(255*n|0,",").concat(255*i|0,")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(xa),xa.h+=e,xa.s+=t,xa.l+=n,this.setHSL(xa.h,xa.s,xa.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(xa),e.getHSL(_a);var n=ui(xa.h,_a.h,t),i=ui(xa.s,_a.s,t),r=ui(xa.l,_a.l,t);return this.setHSL(n,i,r),this}},{key:"setFromVector3",value:function(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}},{key:"applyMatrix3",value:function(e){var t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:E().m(function e(){return E().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.r;case 1:return e.n=2,this.g;case 2:return e.n=3,this.b;case 3:return e.a(2)}},e,this)})}])}(),Sa=new ba;ba.NAMES=ya;var wa=exports.MeshBasicMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshBasicMaterial=!0,n.type="MeshBasicMaterial",n.color=new ba(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=Ee,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.fog=!0,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}])}(),Ta=Aa();function Aa(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(i[a]=0,i[256|a]=32768,r[a]=24,r[256|a]=24):o<-14?(i[a]=1024>>-o-14,i[256|a]=1024>>-o-14|32768,r[a]=-o-1,r[256|a]=-o-1):o<=15?(i[a]=o+15<<10,i[256|a]=o+15<<10|32768,r[a]=13,r[256|a]=13):o<128?(i[a]=31744,i[256|a]=64512,r[a]=24,r[256|a]=24):(i[a]=31744,i[256|a]=64512,r[a]=13,r[256|a]=13)}for(var s=new Uint32Array(2048),u=new Uint32Array(64),l=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var p=1024;p<2048;++p)s[p]=939524096+(p-1024<<13);for(var f=1;f<31;++f)u[f]=f<<23;u[31]=1199570944,u[32]=2147483648;for(var v=33;v<63;++v)u[v]=2147483648+(v-32<<23);u[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(l[m]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:u,offsetTable:l}}function Ea(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=ri(e,-65504,65504),Ta.floatView[0]=e;var t=Ta.uint32View[0],n=t>>23&511;return Ta.baseTable[n]+((8388607&t)>>Ta.shiftTable[n])}function ka(e){var t=e>>10;return Ta.uint32View[0]=Ta.mantissaTable[Ta.offsetTable[t]+(1023&e)]+Ta.exponentTable[t],Ta.floatView[0]}var Ca=exports.DataUtils={toHalfFloat:Ea,fromHalfFloat:ka},La=new nr,Ra=new Ai,Pa=exports.BufferAttribute=function(){return I(function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(R(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=i,this.usage=Fn,this.updateRange={offset:0,count:-1},this.version=0},[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=Si(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=Si(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=Si(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=Si(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=wi(t,this.array),n=wi(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=wi(t,this.array),n=wi(n,this.array),i=wi(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}},{key:"setXYZW",value:function(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=wi(t,this.array),n=wi(n,this.array),i=wi(i,this.array),r=wi(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Fn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}},{key:"copyColorsArray",value:function(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}},{key:"copyVector2sArray",value:function(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}},{key:"copyVector3sArray",value:function(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}},{key:"copyVector4sArray",value:function(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}])}(),Ia=exports.Int8BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Int8Array(e),n,i])}return w(t,Pa),I(t)}(),Da=exports.Uint8BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Uint8Array(e),n,i])}return w(t,Pa),I(t)}(),Ua=exports.Uint8ClampedBufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Uint8ClampedArray(e),n,i])}return w(t,Pa),I(t)}(),Na=exports.Int16BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Int16Array(e),n,i])}return w(t,Pa),I(t)}(),Oa=exports.Uint16BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Uint16Array(e),n,i])}return w(t,Pa),I(t)}(),za=exports.Int32BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Int32Array(e),n,i])}return w(t,Pa),I(t)}(),Ba=exports.Uint32BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Uint32Array(e),n,i])}return w(t,Pa),I(t)}(),Fa=exports.Float16BufferAttribute=function(e){function t(e,n,i){var r;return R(this,t),(r=x(this,t,[new Uint16Array(e),n,i])).isFloat16BufferAttribute=!0,r}return w(t,Pa),I(t,[{key:"getX",value:function(e){var t=ka(this.array[e*this.itemSize]);return this.normalized&&(t=Si(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize]=Ea(t),this}},{key:"getY",value:function(e){var t=ka(this.array[e*this.itemSize+1]);return this.normalized&&(t=Si(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize+1]=Ea(t),this}},{key:"getZ",value:function(e){var t=ka(this.array[e*this.itemSize+2]);return this.normalized&&(t=Si(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize+2]=Ea(t),this}},{key:"getW",value:function(e){var t=ka(this.array[e*this.itemSize+3]);return this.normalized&&(t=Si(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=wi(t,this.array)),this.array[e*this.itemSize+3]=Ea(t),this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=wi(t,this.array),n=wi(n,this.array)),this.array[e+0]=Ea(t),this.array[e+1]=Ea(n),this}},{key:"setXYZ",value:function(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=wi(t,this.array),n=wi(n,this.array),i=wi(i,this.array)),this.array[e+0]=Ea(t),this.array[e+1]=Ea(n),this.array[e+2]=Ea(i),this}},{key:"setXYZW",value:function(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=wi(t,this.array),n=wi(n,this.array),i=wi(i,this.array),r=wi(r,this.array)),this.array[e+0]=Ea(t),this.array[e+1]=Ea(n),this.array[e+2]=Ea(i),this.array[e+3]=Ea(r),this}}])}(),Ga=exports.Float32BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Float32Array(e),n,i])}return w(t,Pa),I(t)}(),Va=exports.Float64BufferAttribute=function(e){function t(e,n,i){return R(this,t),x(this,t,[new Float64Array(e),n,i])}return w(t,Pa),I(t)}(),Ha=0,Wa=new Pr,ja=new ia,qa=new nr,Xa=new ar,Ya=new ar,Za=new nr,Ja=exports.BufferGeometry=function(e){function t(){var e;return R(this,t),(e=x(this,t)).isBufferGeometry=!0,Object.defineProperty(e,"id",{value:Ha++}),e.uuid=ii(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return w(t,Qn),I(t,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(Ci(e)?Ba:Oa)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new Ei).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Wa.makeRotationFromQuaternion(e),this.applyMatrix4(Wa),this}},{key:"rotateX",value:function(e){return Wa.makeRotationX(e),this.applyMatrix4(Wa),this}},{key:"rotateY",value:function(e){return Wa.makeRotationY(e),this.applyMatrix4(Wa),this}},{key:"rotateZ",value:function(e){return Wa.makeRotationZ(e),this.applyMatrix4(Wa),this}},{key:"translate",value:function(e,t,n){return Wa.makeTranslation(e,t,n),this.applyMatrix4(Wa),this}},{key:"scale",value:function(e,t,n){return Wa.makeScale(e,t,n),this.applyMatrix4(Wa),this}},{key:"lookAt",value:function(e){return ja.lookAt(e),ja.updateMatrix(),this.applyMatrix4(ja.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(qa).negate(),this.translate(qa.x,qa.y,qa.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,i=e.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var a in r){var o=r[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},u=!1;for(var l in this.morphAttributes){for(var c=this.morphAttributes[l],h=[],d=0,p=c.length;d0&&(s[l]=h,u=!0)}u&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var i=e.attributes;for(var r in i){var a=i[r];this.setAttribute(r,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var u=[],l=o[s],c=0,h=l.length;c0&&void 0!==arguments[0]?arguments[0]:new Ja,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wa;return R(this,t),(e=x(this,t)).isMesh=!0,e.type="Mesh",e.geometry=n,e.material=i,e.updateMorphTargets(),e}return w(t,ia),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;iMath.pow(e.far-e.near,2))return}if(Ka.copy(r).invert(),Qa.copy(e.ray).applyMatrix4(Ka),null===n.boundingBox||!1!==Qa.intersectsBox(n.boundingBox)){var a,o=n.index,s=n.attributes.position,u=n.attributes.uv,l=n.attributes.uv2,c=n.attributes.normal,h=n.groups,d=n.drawRange;if(null!==o)if(Array.isArray(i))for(var p=0,f=h.length;pn.far?null:{distance:u,point:fo.clone(),object:e}}function go(e,t,n,i,r,a,o,s,u,l){e.getVertexPosition(s,to),e.getVertexPosition(u,no),e.getVertexPosition(l,io);var c=mo(e,t,n,i,to,no,io,po);if(c){r&&(oo.fromBufferAttribute(r,s),so.fromBufferAttribute(r,u),uo.fromBufferAttribute(r,l),c.uv=va.getInterpolation(po,to,no,io,oo,so,uo,new Ai)),a&&(oo.fromBufferAttribute(a,s),so.fromBufferAttribute(a,u),uo.fromBufferAttribute(a,l),c.uv2=va.getInterpolation(po,to,no,io,oo,so,uo,new Ai)),o&&(lo.fromBufferAttribute(o,s),co.fromBufferAttribute(o,u),ho.fromBufferAttribute(o,l),c.normal=va.getInterpolation(po,to,no,io,lo,co,ho,new nr),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));var h={a:s,b:u,c:l,normal:new nr,materialIndex:0};va.getNormal(to,no,io,h.normal),c.face=h}return c}var yo=exports.BoxGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;R(this,t),(e=x(this,t)).type="BoxGeometry",e.parameters={width:n,height:i,depth:r,widthSegments:a,heightSegments:o,depthSegments:s};var u=e;a=Math.floor(a),o=Math.floor(o),s=Math.floor(s);var l=[],c=[],h=[],d=[],p=0,f=0;function v(e,t,n,i,r,a,o,s,v,m,g){for(var y=a/v,x=o/m,_=a/2,M=o/2,b=s/2,S=v+1,w=m+1,T=0,A=0,E=new nr,k=0;k0?1:-1,h.push(E.x,E.y,E.z),d.push(L/v),d.push(1-k/m),T+=1}for(var P=0;P0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(n.extensions=a),n}}])}(),Eo=exports.Camera=function(e){function t(){var e;return R(this,t),(e=x(this,t)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Pr,e.projectionMatrix=new Pr,e.projectionMatrixInverse=new Pr,e}return w(t,ia),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){m(t,"updateMatrixWorld",this,3)([e]),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,n){m(t,"updateWorldMatrix",this,3)([e,n]),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),ko=exports.PerspectiveCamera=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return R(this,t),(e=x(this,t)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=n,e.zoom=1,e.near=r,e.far=a,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return w(t,Eo),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*ni*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*ti*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*ni*Math.atan(Math.tan(.5*ti*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*ti*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var u=this.filmOffset;0!==u&&(r+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,null!==this.view&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}])}(),Co=-90,Lo=1,Ro=exports.CubeCamera=function(e){function t(e,n,i){var r;R(this,t),(r=x(this,t)).type="CubeCamera",r.renderTarget=i;var a=new ko(Co,Lo,e,n);a.layers=r.layers,a.up.set(0,1,0),a.lookAt(1,0,0),r.add(a);var o=new ko(Co,Lo,e,n);o.layers=r.layers,o.up.set(0,1,0),o.lookAt(-1,0,0),r.add(o);var s=new ko(Co,Lo,e,n);s.layers=r.layers,s.up.set(0,0,-1),s.lookAt(0,1,0),r.add(s);var u=new ko(Co,Lo,e,n);u.layers=r.layers,u.up.set(0,0,1),u.lookAt(0,-1,0),r.add(u);var l=new ko(Co,Lo,e,n);l.layers=r.layers,l.up.set(0,1,0),l.lookAt(0,0,1),r.add(l);var c=new ko(Co,Lo,e,n);return c.layers=r.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),r.add(c),r}return w(t,ia),I(t,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,i=c(this.children,6),r=i[0],a=i[1],o=i[2],s=i[3],u=i[4],l=i[5],h=e.getRenderTarget(),d=e.toneMapping,p=e.xr.enabled;e.toneMapping=Le,e.xr.enabled=!1;var f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=f,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}])}(),Po=exports.CubeTexture=function(e){function t(e,n,i,r,a,o,s,u,l,c){var h;return R(this,t),(h=x(this,t,[e=void 0!==e?e:[],n=void 0!==n?n:Oe,i,r,a,o,s,u,l,c])).isCubeTexture=!0,h.flipY=!1,h}return w(t,Xi),I(t,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}])}(),Io=exports.WebGLCubeRenderTarget=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};R(this,t),(e=x(this,t,[n,n,i])).isWebGLCubeRenderTarget=!0;var r={width:n,height:n,depth:1},a=[r,r,r,r,r,r];return e.texture=new Po(a,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,e.texture.minFilter=void 0!==i.minFilter?i.minFilter:Je,e}return w(t,Zi),I(t,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new yo(5,5,5),o=new Ao({name:"CubemapFromEquirect",uniforms:xo(n),vertexShader:i,fragmentShader:r,side:Y,blending:K});o.uniforms.tEquirect.value=t;var s=new vo(a,o),u=t.minFilter;return t.minFilter===$e&&(t.minFilter=Je),new Ro(1,10,this).update(e,s),t.minFilter=u,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,i){for(var r=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}])}(),Do=new nr,Uo=new nr,No=new Ei,Oo=exports.Plane=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(this,e),this.isPlane=!0,this.normal=t,this.constant=n},[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var i=Do.subVectors(n,t).cross(Uo.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}},{key:"intersectLine",value:function(e,t){var n=e.delta(Do),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||No.getNormalMatrix(e),i=this.coplanarPoint(Do).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),zo=new Sr,Bo=new nr,Fo=exports.Frustum=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Oo,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Oo,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Oo,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Oo,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Oo,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new Oo;R(this,e),this.planes=[t,n,i,r,a,o]},[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],u=n[5],l=n[6],c=n[7],h=n[8],d=n[9],p=n[10],f=n[11],v=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,c-s,f-h,y-v).normalize(),t[1].setComponents(o+i,c+s,f+h,y+v).normalize(),t[2].setComponents(o+r,c+u,f+d,y+m).normalize(),t[3].setComponents(o-r,c-u,f-d,y-m).normalize(),t[4].setComponents(o-a,c-l,f-p,y-g).normalize(),t[5].setComponents(o+a,c+l,f+p,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),zo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),zo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(zo)}},{key:"intersectsSprite",value:function(e){return zo.center.set(0,0,0),zo.radius=.7071067811865476,zo.applyMatrix4(e.matrixWorld),this.intersectsSphere(zo)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,Bo.y=i.normal.y>0?e.max.y:e.min.y,Bo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Bo)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}();function Go(){var e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Vo(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){var a=i.get(t);(!a||a.version0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;R(this,t),(e=x(this,t)).type="PlaneGeometry",e.parameters={width:n,height:i,widthSegments:r,heightSegments:a};for(var o=n/2,s=i/2,u=Math.floor(r),l=Math.floor(a),c=u+1,h=l+1,d=n/u,p=i/l,f=[],v=[],m=[],g=[],y=0;y1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),f(l,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){f(l,c=e)},render:function(i,a){var o=!1,v=!0===a.isScene?a.background:null;v&&v.isTexture&&(v=(a.backgroundBlurriness>0?n:t).get(v));var m=e.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(v=null),null===v?f(l,c):v&&v.isColor&&(f(v,1),o=!0),(e.autoClear||o)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Ge)?(void 0===u&&((u=new vo(new yo(1,1,1),new Ao({name:"BackgroundCubeMaterial",uniforms:xo(Ml.backgroundCube.uniforms),vertexShader:Ml.backgroundCube.vertexShader,fragmentShader:Ml.backgroundCube.fragmentShader,side:Y,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=a.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,u.material.toneMapped=v.encoding!==vn,h===v&&d===v.version&&p===e.toneMapping||(u.material.needsUpdate=!0,h=v,d=v.version,p=e.toneMapping),u.layers.enableAll(),i.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(void 0===s&&((s=new vo(new Ho(2,2),new Ao({name:"BackgroundMaterial",uniforms:xo(Ml.background.uniforms),vertexShader:Ml.background.vertexShader,fragmentShader:Ml.background.fragmentShader,side:X,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=v,s.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,s.material.toneMapped=v.encoding!==vn,!0===v.matrixAutoUpdate&&v.updateMatrix(),s.material.uniforms.uvTransform.value.copy(v.matrix),h===v&&d===v.version&&p===e.toneMapping||(s.material.needsUpdate=!0,h=v,d=v.version,p=e.toneMapping),s.layers.enableAll(),i.unshift(s,s.geometry,s.material,0,0,null))}}}function wl(e,t,n,i){var r=e.getParameter(34921),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==a,s={},u=p(null),l=u,c=!1;function h(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function p(e){for(var t=[],n=[],i=[],a=0;a=0){var h=r[u],d=a[u];if(void 0===d&&("instanceMatrix"===u&&e.instanceMatrix&&(d=e.instanceMatrix),"instanceColor"===u&&e.instanceColor&&(d=e.instanceColor)),void 0===h)return!0;if(h.attribute!==d)return!0;if(d&&h.data!==d.data)return!0;o++}}return l.attributesNum!==o||l.index!==i}(r,x,d,_))&&function(e,t,n,i){var r={},a=t.attributes,o=0,s=n.getAttributes();for(var u in s){var c=s[u];if(c.location>=0){var h=a[u];void 0===h&&("instanceMatrix"===u&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===u&&e.instanceColor&&(h=e.instanceColor));var d={};d.attribute=h,h&&h.data&&(d.data=h.data),r[u]=d,o++}}l.attributes=r,l.attributesNum=o,l.index=i}(r,x,d,_)}else{var S=!0===u.wireframe;l.geometry===x.id&&l.program===d.id&&l.wireframe===S||(l.geometry=x.id,l.program=d.id,l.wireframe=S,M=!0)}null!==_&&n.update(_,34963),(M||c)&&(c=!1,function(r,a,o,s){if(!1!==i.isWebGL2||!r.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){f();var u=s.attributes,l=o.getAttributes(),c=a.defaultAttributeValues;for(var h in l){var d=l[h];if(d.location>=0){var p=u[h];if(void 0===p&&("instanceMatrix"===h&&r.instanceMatrix&&(p=r.instanceMatrix),"instanceColor"===h&&r.instanceColor&&(p=r.instanceColor)),void 0!==p){var x=p.normalized,_=p.itemSize,M=n.get(p);if(void 0===M)continue;var b=M.buffer,S=M.type,w=M.bytesPerElement;if(p.isInterleavedBufferAttribute){var T=p.data,A=T.stride,E=p.offset;if(T.isInstancedInterleavedBuffer){for(var k=0;k0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var u=a||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),v=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:u,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function El(e){var t=this,n=null,i=0,r=!1,a=!1,o=new Oo,s=new Ei,u={value:null,needsUpdate:!1};function l(e,n,i,r){var a=null!==e?e.length:0,l=null;if(0!==a){if(l=u.value,!0!==r||null===l){var c=i+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===l||l.length0);t.numPlanes=i,t.numIntersection=0}();else{var v=a?0:i,m=4*v,g=f.clippingState||null;u.value=g,g=l(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function kl(e){var t=new WeakMap;function n(e,t){return t===Be?e.mapping=Oe:t===Fe&&(e.mapping=ze),e}function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){var a=r.mapping;if(a===Be||a===Fe){if(t.has(r))return n(t.get(r).texture,r.mapping);var o=r.image;if(o&&o.height>0){var s=new Io(o.height/2);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}return r},dispose:function(){t=new WeakMap}}}var Cl=exports.OrthographicCamera=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return R(this,t),(e=x(this,t)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=n,e.right=i,e.top=r,e.bottom=a,e.near=o,e.far=s,e.updateProjectionMatrix(),e}return w(t,Eo),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var u=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=u*this.view.offsetX)+u*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,null!==this.view&&(n.object.view=Object.assign({},this.view)),n}}])}(),Ll=4,Rl=[.125,.215,.35,.446,.526,.582],Pl=20,Il=new Cl,Dl=new ba,Ul=null,Nl=(1+Math.sqrt(5))/2,Ol=1/Nl,zl=[new nr(1,1,1),new nr(-1,1,1),new nr(1,1,-1),new nr(-1,1,-1),new nr(0,Nl,Ol),new nr(0,Nl,-Ol),new nr(Ol,0,Nl),new nr(-Ol,0,Nl),new nr(Nl,Ol,0),new nr(-Nl,Ol,0)],Bl=exports.PMREMGenerator=function(){return I(function e(t){R(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)},[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Ul=this._renderer.getRenderTarget(),this._setSize(256);var r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=jl(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Wl(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e2?m:0,m,m),s.setRenderTarget(i),d&&s.render(h,r),s.render(e,r)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=l,s.autoClear=u,e.background=p}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,i=e.mapping===Oe||e.mapping===ze;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=jl()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Wl());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new vo(this._lodPlanes[0],r);r.uniforms.envMap.value=e;var o=this._cubeSize;Vl(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Il)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;iPl&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(Pl));for(var v=[],m=0,g=0;gM-Ll?i-M+Ll:0),4*(this._cubeSize-b),3*b,2*b),s.setRenderTarget(t),s.render(l,Il)}}])}();function Fl(e){for(var t=[],n=[],i=[],r=e,a=e-Ll+1+Rl.length,o=0;oe-Ll?u=Rl[o-e+Ll-1]:0===o&&(u=0),i.push(u);for(var l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],p=new Float32Array(108),f=new Float32Array(72),v=new Float32Array(36),m=0;m<6;m++){var g=m%3*2/3-1,y=m>2?0:-1,x=[g,y,0,g+2/3,y,0,g+2/3,y+1,0,g,y,0,g+2/3,y+1,0,g,y+1,0];p.set(x,18*m),f.set(d,12*m);var _=[m,m,m,m,m,m];v.set(_,6*m)}var M=new Ja;M.setAttribute("position",new Pa(p,3)),M.setAttribute("uv",new Pa(f,2)),M.setAttribute("faceIndex",new Pa(v,1)),t.push(M),r>Ll&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}function Gl(e,t,n){var i=new Zi(e,t,n);return i.texture.mapping=Ge,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Vl(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Hl(e,t,n){var i=new Float32Array(Pl),r=new nr(0,1,0);return new Ao({name:"SphericalGaussianBlur",defines:{n:Pl,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ql(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:K,depthTest:!1,depthWrite:!1})}function Wl(){return new Ao({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ql(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:K,depthTest:!1,depthWrite:!1})}function jl(){return new Ao({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ql(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:K,depthTest:!1,depthWrite:!1})}function ql(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Xl(e){var t=new WeakMap,n=null;function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){var a=r.mapping,o=a===Be||a===Fe,s=a===Oe||a===ze;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;var u=t.get(r);return null===n&&(n=new Bl(e)),u=o?n.fromEquirectangular(r,u):n.fromCubemap(r,u),t.set(r,u),u.texture}if(t.has(r))return t.get(r).texture;var l=r.image;if(o&&l&&l.height>0||s&&l&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)){null===n&&(n=new Bl(e));var c=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,c),r.addEventListener("dispose",i),c.texture}return null}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Yl(e){var t={};function n(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Zl(e,t,n,i){var r={},a=new WeakMap;function o(e){var s=e.target;for(var u in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[u]);s.removeEventListener("dispose",o),delete r[s.id];var l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],i=e.index,r=e.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var u=0,l=s.length;ut.maxTextureSize&&(S=Math.ceil(b/t.maxTextureSize),b=t.maxTextureSize);var w=new Float32Array(b*S*4*p),T=new Ji(w,b,S,p);T.type=st,T.needsUpdate=!0;for(var A=4*M,E=0;E0)return e;var r=t*n,a=oc[r];if(void 0===a&&(a=new Float32Array(r),oc[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function dc(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n":" "," ").concat(s,": ").concat(n[o]))}return i.join("\n")}function hh(e){switch(e){case fn:return["Linear","( value )"];case vn:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function dh(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";var a=/ERROR: 0:(\d+)/.exec(r);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+ch(e.getShaderSource(t),o)}return r}function ph(e,t){var n=hh(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function fh(e,t){var n;switch(t){case Re:n="Linear";break;case Pe:n="Reinhard";break;case Ie:n="OptimizedCineon";break;case De:n="ACESFilmic";break;case Ue:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function vh(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(yh).join("\n")}function mh(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}function gh(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r/gm;function bh(e){return e.replace(Mh,Sh)}function Sh(e,t){var n=xl[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return bh(n)}var wh=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Th(e){return e.replace(wh,Ah)}function Ah(e,t,n,i){for(var r="",a=parseInt(t);a0&&(r+="\n"),(a=[v,m].filter(yh).join("\n")).length>0&&(a+="\n")):(r=[Eh(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs2?"#define USE_UV2":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(yh).join("\n"),a=[v,Eh(n),"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs2?"#define USE_UV2":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Le?"#define TONE_MAPPING":"",n.toneMapping!==Le?xl.tonemapping_pars_fragment:"",n.toneMapping!==Le?fh("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",xl.encodings_pars_fragment,ph("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(yh).join("\n")),u=_h(u=xh(u=bh(u),n),n),l=_h(l=xh(l=bh(l),n),n),u=Th(u),l=Th(l),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",r=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",n.glslVersion===Jn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Jn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var x,_,M=y+a+l,b=uh(o,35633,y+r+u),S=uh(o,35632,M);if(o.attachShader(g,b),o.attachShader(g,S),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var w=o.getProgramInfoLog(g).trim(),T=o.getShaderInfoLog(b).trim(),A=o.getShaderInfoLog(S).trim(),E=!0,k=!0;if(!1===o.getProgramParameter(g,35714))if(E=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(o,g,b,S);else{var C=dh(o,b,"vertex"),L=dh(o,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+w+"\n"+C+"\n"+L)}else""!==w?console.warn("THREE.WebGLProgram: Program Info Log:",w):""!==T&&""!==A||(k=!1);k&&(this.diagnostics={runnable:E,programLog:w,vertexShader:{log:T,prefix:r},fragmentShader:{log:A,prefix:a}})}return o.deleteShader(b),o.deleteShader(S),this.getUniforms=function(){return void 0===x&&(x=new sh(o,g)),x},this.getAttributes=function(){return void 0===_&&(_=gh(o,g)),_},this.destroy=function(){i.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=lh++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=S,this}var Dh=0,Uh=function(){return I(function e(){R(this,e),this.shaderCache=new Map,this.materialCache=new Map},[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}},{key:"remove",value:function(e){var t,n=l(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var i=t.value;i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code)}}catch(r){n.e(r)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new Nh(e),t.set(e,n)),n}}])}(),Nh=I(function e(t){R(this,e),this.id=Dh++,this.code=t,this.usedTimes=0});function Oh(e,t,n,i,r,a,o){var s=new Hr,u=new Uh,l=[],c=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures,p=r.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(e){return 1===e?"uv2":"uv"}return{getParameters:function(a,s,l,m,g){var y=m.fog,x=g.geometry,_=a.isMeshStandardMaterial?m.environment:null,M=(a.isMeshStandardMaterial?n:t).get(a.envMap||_),b=M&&M.mapping===Ge?M.image.height:null,S=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");var w,T,A,E,k=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,C=void 0!==k?k.length:0,L=0;if(void 0!==x.morphAttributes.position&&(L=1),void 0!==x.morphAttributes.normal&&(L=2),void 0!==x.morphAttributes.color&&(L=3),S){var R=Ml[S];w=R.vertexShader,T=R.fragmentShader}else w=a.vertexShader,T=a.fragmentShader,u.update(a),A=u.getVertexShaderID(a),E=u.getFragmentShaderID(a);var P=e.getRenderTarget(),I=!0===g.isInstancedMesh,D=!!a.map,U=!!a.matcap,N=!!M,O=!!a.aoMap,z=!!a.lightMap,B=!!a.bumpMap,F=!!a.normalMap,G=!!a.displacementMap,V=!!a.emissiveMap,H=!!a.metalnessMap,W=!!a.roughnessMap,j=a.clearcoat>0,q=a.iridescence>0,X=a.sheen>0,J=a.transmission>0,K=j&&!!a.clearcoatMap,$=j&&!!a.clearcoatNormalMap,ee=j&&!!a.clearcoatRoughnessMap,te=q&&!!a.iridescenceMap,ne=q&&!!a.iridescenceThicknessMap,ie=X&&!!a.sheenColorMap,re=X&&!!a.sheenRoughnessMap,ae=!!a.specularMap,oe=!!a.specularColorMap,se=!!a.specularIntensityMap,ue=J&&!!a.transmissionMap,le=J&&!!a.thicknessMap,ce=!!a.gradientMap,he=!!a.alphaMap,de=a.alphaTest>0,pe=!!a.extensions,fe=!!x.attributes.uv2;return{isWebGL2:c,shaderID:S,shaderName:a.type,vertexShader:w,fragmentShader:T,defines:a.defines,customVertexShaderID:A,customFragmentShaderID:E,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:I,instancingColor:I&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===P?e.outputEncoding:!0===P.isXRRenderTarget?P.texture.encoding:fn,map:D,matcap:U,envMap:N,envMapMode:N&&M.mapping,envMapCubeUVHeight:b,aoMap:O,lightMap:z,bumpMap:B,normalMap:F,displacementMap:d&&G,emissiveMap:V,normalMapObjectSpace:F&&a.normalMapType===xn,normalMapTangentSpace:F&&a.normalMapType===yn,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&a.map.encoding===vn,metalnessMap:H,roughnessMap:W,clearcoat:j,clearcoatMap:K,clearcoatNormalMap:$,clearcoatRoughnessMap:ee,iridescence:q,iridescenceMap:te,iridescenceThicknessMap:ne,sheen:X,sheenColorMap:ie,sheenRoughnessMap:re,specularMap:ae,specularColorMap:oe,specularIntensityMap:se,transmission:J,transmissionMap:ue,thicknessMap:le,gradientMap:ce,opaque:!1===a.transparent&&a.blending===Q,alphaMap:he,alphaTest:de,combine:a.combine,mapUv:D&&v(a.map.channel),aoMapUv:O&&v(a.aoMap.channel),lightMapUv:z&&v(a.lightMap.channel),bumpMapUv:B&&v(a.bumpMap.channel),normalMapUv:F&&v(a.normalMap.channel),displacementMapUv:G&&v(a.displacementMap.channel),emissiveMapUv:V&&v(a.emissiveMap.channel),metalnessMapUv:H&&v(a.metalnessMap.channel),roughnessMapUv:W&&v(a.roughnessMap.channel),clearcoatMapUv:K&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:$&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:ie&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:re&&v(a.sheenRoughnessMap.channel),specularMapUv:ae&&v(a.specularMap.channel),specularColorMapUv:oe&&v(a.specularColorMap.channel),specularIntensityMapUv:se&&v(a.specularIntensityMap.channel),transmissionMapUv:ue&&v(a.transmissionMap.channel),thicknessMapUv:le&&v(a.thicknessMap.channel),alphaMapUv:he&&v(a.alphaMap.channel),vertexTangents:F&&!!x.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,vertexUvs2:fe,pointsUvs:!0===g.isPoints&&!!x.attributes.uv&&(D||he),fog:!!y,useFog:!0===a.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:C,morphTextureStride:L,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:Le,useLegacyLights:e.useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===Z,flipSided:a.side===Y,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:pe&&!0===a.extensions.derivatives,extensionFragDepth:pe&&!0===a.extensions.fragDepth,extensionDrawBuffers:pe&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:pe&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUvs2&&s.enable(13),t.vertexTangents&&s.enable(14),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.useLegacyLights&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.decodeVideoTexture&&s.enable(17),t.opaque&&s.enable(18),t.pointsUvs&&s.enable(19),e.push(s.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=f[e.type];if(n){var i=Ml[n];t=So.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var i,r=0,o=l.length;r0?i.push(c):!0===o.transparent?r.push(c):n.push(c)},unshift:function(e,t,o,s,u,l){var c=a(e,t,o,s,u,l);o.transmission>0?i.unshift(c):!0===o.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(var n=t,i=e.length;n1&&n.sort(e||Bh),i.length>1&&i.sort(t||Fh),r.length>1&&r.sort(t||Fh)}}}function Vh(){var e=new WeakMap;return{get:function(t,n){var i,r=e.get(t);return void 0===r?(i=new Gh,e.set(t,[i])):n>=r.length?(i=new Gh,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function Hh(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new nr,color:new ba};break;case"SpotLight":n={position:new nr,direction:new nr,color:new ba,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new nr,color:new ba,distance:0,decay:0};break;case"HemisphereLight":n={direction:new nr,skyColor:new ba,groundColor:new ba};break;case"RectAreaLight":n={color:new ba,position:new nr,halfWidth:new nr,halfHeight:new nr}}return e[t.id]=n,n}}}function Wh(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ai};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ai,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}var jh=0;function qh(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Xh(e,t){for(var n=new Hh,i=Wh(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0},a=0;a<9;a++)r.probe.push(new nr);var o=new nr,s=new Pr,u=new Pr;return{setup:function(a,o){for(var s=0,u=0,l=0,c=0;c<9;c++)r.probe[c].set(0,0,0);var h=0,d=0,p=0,f=0,v=0,m=0,g=0,y=0,x=0,_=0;a.sort(qh);for(var M=!0===o?Math.PI:1,b=0,S=a.length;b0&&(t.isWebGL2?(r.rectAreaLTC1=_l.LTC_FLOAT_1,r.rectAreaLTC2=_l.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=_l.LTC_FLOAT_1,r.rectAreaLTC2=_l.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=_l.LTC_HALF_1,r.rectAreaLTC2=_l.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=u,r.ambient[2]=l;var G=r.hash;G.directionalLength===h&&G.pointLength===d&&G.spotLength===p&&G.rectAreaLength===f&&G.hemiLength===v&&G.numDirectionalShadows===m&&G.numPointShadows===g&&G.numSpotShadows===y&&G.numSpotMaps===x||(r.directional.length=h,r.spot.length=p,r.rectArea.length=f,r.point.length=d,r.hemi.length=v,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=y+x-_,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=_,G.directionalLength=h,G.pointLength=d,G.spotLength=p,G.rectAreaLength=f,G.hemiLength=v,G.numDirectionalShadows=m,G.numPointShadows=g,G.numSpotShadows=y,G.numSpotMaps=x,r.version=jh++)},setupView:function(e,t){for(var n=0,i=0,a=0,l=0,c=0,h=t.matrixWorldInverse,d=0,p=e.length;d1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(i);return void 0===o?(r=new Yh(e,t),n.set(i,[r])):a>=o.length?(r=new Yh(e,t),o.push(r)):r=o[a],r},dispose:function(){n=new WeakMap}}}var Jh=exports.MeshDepthMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshDepthMaterial=!0,n.type="MeshDepthMaterial",n.depthPacking=mn,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}])}(),Kh=exports.MeshDistanceMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshDistanceMaterial=!0,n.type="MeshDistanceMaterial",n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}])}(),Qh="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",$h="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function ed(e,t,n){var i=new Fo,r=new Ai,a=new Ai,o=new Yi,s=new Jh({depthPacking:gn}),u=new Kh,l={},c=n.maxTextureSize,h=A(A(A({},X,Y),Y,X),Z,Z),d=new Ao({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ai},radius:{value:4}},vertexShader:Qh,fragmentShader:$h}),p=d.clone();p.defines.HORIZONTAL_PASS=1;var f=new Ja;f.setAttribute("position",new Pa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new vo(f,d),m=this;function g(n,i){var a=t.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Zi(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,d,v,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,p,v,null)}function y(t,n,i,r){var a=null,o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?u:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var c=a.uuid,d=n.uuid,p=l[c];void 0===p&&(p={},l[c]=p);var f=p[d];void 0===f&&(f=a.clone(),p[d]=f),a=f}(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===q?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial)&&(e.properties.get(a).light=i);return a}function x(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===q)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var u=t.update(n),l=n.material;if(Array.isArray(l))for(var c=u.groups,h=0,d=c.length;hc||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/_.x),r.x=a.x*_.x,y.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/_.y),r.y=a.y*_.y,y.mapSize.y=a.y)),null===y.map){var M=this.type!==q?{minFilter:je,magFilter:je}:{};y.map=new Zi(r.x,r.y,M),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var b=y.getViewportCount(),S=0;S=1):-1!==I.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(I)[1]),R=P>=2);var D=null,U={},N=e.getParameter(3088),O=e.getParameter(2978),z=(new Yi).fromArray(N),V=(new Yi).fromArray(O);function H(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;oi||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Mi:Math.floor,o=a(r*e.width),u=a(r*e.height);void 0===s&&(s=y(o,u));var l=n?y(o,u):s;return l.width=o,l.height=u,l.getContext("2d").drawImage(e,0,0,o,u),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+u+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function _(e){return xi(e.width)&&xi(e.height)}function M(e,t){return e.generateMipmaps&&t&&e.minFilter!==je&&e.minFilter!==Je}function b(t){e.generateMipmap(t)}function S(n,i,r,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===u)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;return 6403===i&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),33319===i&&(5126===r&&(s=33328),5131===r&&(s=33327),5121===r&&(s=33323)),6408===i&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=a===vn&&!1===o?35907:32856),32819===r&&(s=32854),32820===r&&(s=32855)),33325!==s&&33326!==s&&33327!==s&&33328!==s&&34842!==s&&34836!==s||t.get("EXT_color_buffer_float"),s}function w(e,t,n){return!0===M(e,n)||e.isFramebufferTexture&&e.minFilter!==je&&e.minFilter!==Je?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function T(e){return e===je||e===qe||e===Ye?9728:9729}function E(e){var t=e.target;t.removeEventListener("dispose",E),function(e){var t=i.get(e);if(void 0===t.__webglInit)return;var n=e.source,r=m.get(n);if(r){var a=r[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&C(e),0===Object.keys(r).length&&m.delete(n)}i.remove(e)}(t),t.isVideoTexture&&v.delete(t)}function k(t){var n=t.target;n.removeEventListener("dispose",k),function(t){var n=t.texture,r=i.get(t),a=i.get(n);void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(r.__webglFramebuffer[s]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[s]);else{if(e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(var u=0;u0&&r.__version!==e.version){var a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void N(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(3553,r.__webglTexture,33984+t)}var P=A(A(A({},Ve,10497),He,33071),We,33648),I=A(A(A(A(A(A({},je,9728),qe,9984),Ye,9986),Je,9729),Ke,9985),$e,9987);function D(n,a,o){if(o?(e.texParameteri(n,10242,P[a.wrapS]),e.texParameteri(n,10243,P[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===He&&a.wrapT===He||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,T(a.magFilter)),e.texParameteri(n,10241,T(a.minFilter)),a.minFilter!==je&&a.minFilter!==Je&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.magFilter===je)return;if(a.minFilter!==Ye&&a.minFilter!==$e)return;if(a.type===st&&!1===t.has("OES_texture_float_linear"))return;if(!1===u&&a.type===ut&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function U(t,n){var i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",E));var r=n.source,a=m.get(r);void 0===a&&(a={},m.set(r,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var u=a[t.__cacheKey];void 0!==u&&(a[t.__cacheKey].usedTimes--,0===u.usedTimes&&C(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function N(t,r,o){var s=3553;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(s=35866),r.isData3DTexture&&(s=32879);var l=U(t,r),c=r.source;n.bindTexture(s,t.__webglTexture,33984+o);var d=i.get(c);if(c.version!==d.__version||!0===l){n.activeTexture(33984+o),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);var p,f=function(e){return!u&&(e.wrapS!==He||e.wrapT!==He||e.minFilter!==je&&e.minFilter!==Je)}(r)&&!1===_(r.image),v=x(r.image,f,!1,h),m=_(v=V(r,v))||u,g=a.convert(r.format,r.encoding),y=a.convert(r.type),T=S(r.internalFormat,g,y,r.encoding,r.isVideoTexture);D(s,r,m);var A=r.mipmaps,E=u&&!0!==r.isVideoTexture,k=void 0===d.__version||!0===l,C=w(r,v,m);if(r.isDepthTexture)T=6402,u?T=r.type===st?36012:r.type===ot?33190:r.type===ht?35056:33189:r.type===st&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===mt&&6402===T&&r.type!==rt&&r.type!==ot&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=ot,y=a.convert(r.type)),r.format===gt&&6402===T&&(T=34041,r.type!==ht&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ht,y=a.convert(r.type))),k&&(E?n.texStorage2D(3553,1,T,v.width,v.height):n.texImage2D(3553,0,T,v.width,v.height,0,g,y,null));else if(r.isDataTexture)if(A.length>0&&m){E&&k&&n.texStorage2D(3553,C,T,A[0].width,A[0].height);for(var L=0,R=A.length;L>=1,B>>=1}else if(A.length>0&&m){E&&k&&n.texStorage2D(3553,C,T,A[0].width,A[0].height);for(var G=0,H=A.length;G=34069&&u<=34074)&&e.framebufferTexture2D(36160,s,u,i.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function z(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i||G(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===st?r=36012:o.type===ot&&(r=33190));var s=F(n);G(n)?p.renderbufferStorageMultisampleEXT(36161,s,r,n.width,n.height):e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){var u=F(n);i&&!1===G(n)?e.renderbufferStorageMultisample(36161,u,35056,n.width,n.height):G(n)?p.renderbufferStorageMultisampleEXT(36161,u,35056,n.width,n.height):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else for(var l=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function V(e,n){var i=e.encoding,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===Kn?n:(i!==fn&&(i===vn?!1===u?!0===t.has("EXT_sRGB")&&r===pt?(e.format=Kn,e.minFilter=Je,e.generateMipmaps=!1):n=Hi.sRGBToLinear(n):r===pt&&a===tt||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n)}this.allocateTextureUnit=function(){var e=L;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?N(r,e,t):n.bindTexture(35866,r.__webglTexture,33984+t)},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?N(r,e,t):n.bindTexture(32879,r.__webglTexture,33984+t)},this.setTextureCube=function(t,r){var o=i.get(t);t.version>0&&o.__version!==t.version?function(t,r,o){if(6===r.image.length){var s=U(t,r),l=r.source;n.bindTexture(34067,t.__webglTexture,33984+o);var h=i.get(l);if(l.version!==h.__version||!0===s){n.activeTexture(33984+o),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var d=r.isCompressedTexture||r.image[0].isCompressedTexture,p=r.image[0]&&r.image[0].isDataTexture,f=[],v=0;v<6;v++)f[v]=d||p?p?r.image[v].image:r.image[v]:x(r.image[v],!1,!0,c),f[v]=V(r,f[v]);var m,g=f[0],y=_(g)||u,T=a.convert(r.format,r.encoding),A=a.convert(r.type),E=S(r.internalFormat,T,A,r.encoding),k=u&&!0!==r.isVideoTexture,C=void 0===h.__version||!0===s,L=w(r,g,y);if(D(34067,r,y),d){k&&C&&n.texStorage2D(34067,L,E,g.width,g.height);for(var R=0;R<6;R++){m=f[R].mipmaps;for(var P=0;P0&&L++,n.texStorage2D(34067,L,E,f[0].width,f[0].height));for(var N=0;N<6;N++)if(p){k?n.texSubImage2D(34069+N,0,0,0,f[N].width,f[N].height,T,A,f[N].data):n.texImage2D(34069+N,0,E,f[N].width,f[N].height,0,T,A,f[N].data);for(var O=0;O0&&!1===G(t)){var x=d?s:[s];l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer);for(var w=0;w0&&!1===G(t)){var r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=16384,l=[],c=t.stencilBuffer?33306:36096,h=i.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(var p=0;p1&&void 0!==arguments[1]?arguments[1]:null;if(n===tt)return 5121;if(n===lt)return 32819;if(n===ct)return 32820;if(n===nt)return 5120;if(n===it)return 5122;if(n===rt)return 5123;if(n===at)return 5124;if(n===ot)return 5125;if(n===st)return 5126;if(n===ut)return i?5131:null!==(r=t.get("OES_texture_half_float"))?r.HALF_FLOAT_OES:null;if(n===dt)return 6406;if(n===pt)return 6408;if(n===ft)return 6409;if(n===vt)return 6410;if(n===mt)return 6402;if(n===gt)return 34041;if(n===Kn)return null!==(r=t.get("EXT_sRGB"))?r.SRGB_ALPHA_EXT:null;if(n===yt)return 6403;if(n===xt)return 36244;if(n===_t)return 33319;if(n===Mt)return 33320;if(n===bt)return 36249;if(n===St||n===wt||n===Tt||n===At)if(a===vn){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===St)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===wt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Tt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===At)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===St)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===wt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Tt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===At)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Et||n===kt||n===Ct||n===Lt){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===Et)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===kt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ct)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Lt)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Rt)return null!==(r=t.get("WEBGL_compressed_texture_etc1"))?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Pt||n===It){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(n===Pt)return a===vn?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===It)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Dt||n===Ut||n===Nt||n===Ot||n===zt||n===Bt||n===Ft||n===Gt||n===Vt||n===Ht||n===Wt||n===jt||n===qt||n===Xt){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(n===Dt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ut)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Nt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ot)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===zt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Bt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ft)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Gt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Vt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ht)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Wt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===jt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===qt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Xt)return a===vn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Yt){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(n===Yt)return a===vn?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(n===Zt||n===Jt||n===Kt||n===Qt){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(n===Yt)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Jt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Kt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Qt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===ht?i?34042:null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var rd=exports.ArrayCamera=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return R(this,t),(e=x(this,t)).isArrayCamera=!0,e.cameras=n,e}return w(t,ko),I(t)}(),ad=exports.Group=function(e){function t(){var e;return R(this,t),(e=x(this,t)).isGroup=!0,e.type="Group",e}return w(t,ia),I(t)}(),od={type:"move"},sd=function(){return I(function e(){R(this,e),this._targetRay=null,this._grip=null,this._hand=null},[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new ad,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new ad,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new nr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new nr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new ad,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new nr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new nr),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,i=l(e.hand.values());try{for(i.s();!(n=i.n()).done;){var r=n.value;this._getHandJoint(t,r)}}catch(a){i.e(a)}finally{i.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var i=null,r=null,a=null,o=this._targetRay,s=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(u&&e.hand){a=!0;var c,h=l(e.hand.values());try{for(h.s();!(c=h.n()).done;){var d=c.value,p=t.getJointPose(d,n),f=this._getHandJoint(u,d);null!==p&&(f.matrix.fromArray(p.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=p.radius),f.visible=null!==p}}catch(y){h.e(y)}finally{h.f()}var v=u.joints["index-finger-tip"],m=u.joints["thumb-tip"],g=v.position.distanceTo(m.position);u.inputState.pinching&&g>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&g<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(od)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==u&&(u.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new ad;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}])}(),ud=exports.DepthTexture=function(e){function t(e,n,i,r,a,o,s,u,l,c){var h;if(R(this,t),(c=void 0!==c?c:mt)!==mt&&c!==gt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&c===mt&&(i=ot),void 0===i&&c===gt&&(i=ht),(h=x(this,t,[null,r,a,o,s,u,c,i,l])).isDepthTexture=!0,h.image={width:e,height:n},h.magFilter=void 0!==s?s:je,h.minFilter=void 0!==u?u:je,h.flipY=!1,h.generateMipmaps=!1,h}return w(t,Xi),I(t)}(),ld=function(e){function t(e,n){var i;R(this,t);var r=i=x(this,t),a=null,o=1,s=null,c="local-floor",h=1,d=null,p=null,f=null,v=null,m=null,g=null,y=n.getContextAttributes(),_=null,M=null,b=[],S=[],w=new Set,T=new Map,A=new ko;A.layers.enable(1),A.viewport=new Yi;var k=new ko;k.layers.enable(2),k.viewport=new Yi;var C=[A,k],L=new rd;L.layers.enable(1),L.layers.enable(2);var P=null,I=null;function D(e){var t=S.indexOf(e.inputSource);if(-1!==t){var n=b[t];void 0!==n&&n.dispatchEvent({type:e.type,data:e.inputSource})}}function U(){a.removeEventListener("select",D),a.removeEventListener("selectstart",D),a.removeEventListener("selectend",D),a.removeEventListener("squeeze",D),a.removeEventListener("squeezestart",D),a.removeEventListener("squeezeend",D),a.removeEventListener("end",U),a.removeEventListener("inputsourceschange",N);for(var t=0;t=0&&(S[i]=null,b[i].disconnect(n))}for(var r=0;r=S.length){S.push(a),o=s;break}if(null===S[s]){S[s]=a,o=s;break}}if(-1===o)break}var u=b[o];u&&u.connect(a)}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=b[e];return void 0===t&&(t=new sd,b[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=b[e];return void 0===t&&(t=new sd,b[e]=t),t.getGripSpace()},i.getHand=function(e){var t=b[e];return void 0===t&&(t=new sd,b[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){o=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return d||s},i.setReferenceSpace=function(e){d=e},i.getBaseLayer=function(){return null!==v?v:m},i.getBinding=function(){return f},i.getFrame=function(){return g},i.getSession=function(){return a},i.setSession=function(){var t=u(E().m(function t(i){var u,l,p,g,x;return E().w(function(t){for(;;)switch(t.n){case 0:if(null===(a=i)){t.n=3;break}if(_=e.getRenderTarget(),a.addEventListener("select",D),a.addEventListener("selectstart",D),a.addEventListener("selectend",D),a.addEventListener("squeeze",D),a.addEventListener("squeezestart",D),a.addEventListener("squeezeend",D),a.addEventListener("end",U),a.addEventListener("inputsourceschange",N),!0===y.xrCompatible){t.n=1;break}return t.n=1,n.makeXRCompatible();case 1:return void 0===a.renderState.layers||!1===e.capabilities.isWebGL2?(u={antialias:void 0!==a.renderState.layers||y.antialias,alpha:y.alpha,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o},m=new XRWebGLLayer(a,n,u),a.updateRenderState({baseLayer:m}),M=new Zi(m.framebufferWidth,m.framebufferHeight,{format:pt,type:tt,encoding:e.outputEncoding,stencilBuffer:y.stencil})):(l=null,p=null,g=null,y.depth&&(g=y.stencil?35056:33190,l=y.stencil?gt:mt,p=y.stencil?ht:ot),x={colorFormat:32856,depthFormat:g,scaleFactor:o},f=new XRWebGLBinding(a,n),v=f.createProjectionLayer(x),a.updateRenderState({layers:[v]}),M=new Zi(v.textureWidth,v.textureHeight,{format:pt,type:tt,depthTexture:new ud(v.textureWidth,v.textureHeight,p,void 0,void 0,void 0,void 0,void 0,void 0,l),stencilBuffer:y.stencil,encoding:e.outputEncoding,samples:y.antialias?4:0}),e.properties.get(M).__ignoreDepthValues=v.ignoreDepthValues),M.isXRRenderTarget=!0,this.setFoveation(h),d=null,t.n=2,a.requestReferenceSpace(c);case 2:s=t.v,G.setContext(a),G.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"});case 3:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}();var O=new nr,z=new nr;function B(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==a){L.near=k.near=A.near=e.near,L.far=k.far=A.far=e.far,P===L.near&&I===L.far||(a.updateRenderState({depthNear:L.near,depthFar:L.far}),P=L.near,I=L.far);var t=e.parent,n=L.cameras;B(L,t);for(var i=0;iB&&(T.set(z,z.lastChangedTime),r.dispatchEvent({type:"planechanged",data:z}))}else w.add(z),T.set(z,n.lastChangedTime),r.dispatchEvent({type:"planeadded",data:z})}}catch(G){O.e(G)}finally{O.f()}}g=null}),i.setAnimationLoop=function(e){F=e},i.dispose=function(){},i}return w(t,Qn),I(t)}();function cd(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(i,r){i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map,n(r.map,i.mapTransform)),r.alphaMap&&(i.alphaMap.value=r.alphaMap,n(r.alphaMap,i.alphaMapTransform)),r.bumpMap&&(i.bumpMap.value=r.bumpMap,n(r.bumpMap,i.bumpMapTransform),i.bumpScale.value=r.bumpScale,r.side===Y&&(i.bumpScale.value*=-1)),r.normalMap&&(i.normalMap.value=r.normalMap,n(r.normalMap,i.normalMapTransform),i.normalScale.value.copy(r.normalScale),r.side===Y&&i.normalScale.value.negate()),r.displacementMap&&(i.displacementMap.value=r.displacementMap,n(r.displacementMap,i.displacementMapTransform),i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,i.emissiveMapTransform)),r.specularMap&&(i.specularMap.value=r.specularMap,n(r.specularMap,i.specularMapTransform)),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);var a=t.get(r).envMap;if(a&&(i.envMap.value=a,i.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;var o=!0===e.useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*o,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,bo(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s){r.isMeshBasicMaterial?i(e,r):r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,i){e.metalness.value=i.metalness,i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,e.metalnessMapTransform)),e.roughness.value=i.roughness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,e.roughnessMapTransform)),t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===Y&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){var i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function hd(e,t,n,i){var r={},a={},o=[],s=n.isWebGL2?e.getParameter(35375):0;function u(e,t,n){var i=e.value;if(void 0===n[t]){if("number"==typeof i)n[t]=i;else{for(var r=Array.isArray(i)?i:[i],a=[],o=0;o0){var f=16-(i=n%16);0!==i&&f-s.boundary<0&&(n+=16-i,o.__offset=n)}n+=s.storage}(i=n%16)>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{};R(this,e);var n,i=t.canvas,r=void 0===i?dd():i,a=t.context,o=void 0===a?null:a,s=t.depth,u=void 0===s||s,l=t.stencil,c=void 0===l||l,h=t.alpha,d=void 0!==h&&h,p=t.antialias,f=void 0!==p&&p,v=t.premultipliedAlpha,m=void 0===v||v,g=t.preserveDrawingBuffer,y=void 0!==g&&g,x=t.powerPreference,_=void 0===x?"default":x,M=t.failIfMajorPerformanceCaveat,b=void 0!==M&&M;this.isWebGLRenderer=!0,n=null!==o?o.getContextAttributes().alpha:d;var S=null,w=null,T=[],A=[];this.domElement=r,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=fn,this.useLegacyLights=!0,this.toneMapping=Le,this.toneMappingExposure=1;var E=this,k=!1,C=0,L=0,P=null,I=-1,D=null,U=new Yi,O=new Yi,z=null,B=r.width,F=r.height,G=1,V=null,H=null,W=new Yi(0,0,B,F),j=new Yi(0,0,B,F),q=!1,J=new Fo,K=!1,Q=!1,$=null,ee=new Pr,te=new nr,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ie(){return null===P?G:1}var re,ae,oe,se,ue,le,ce,he,de,pe,fe,ve,me,ge,ye,xe,_e,Me,be,Se,we,Te,Ae,Ee,ke=o;function Ce(e,t){for(var n=0;n2&&void 0!==arguments[2])||arguments[2];De.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(B=e,F=t,r.width=Math.floor(e*G),r.height=Math.floor(t*G),!0===n&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(B*G,F*G).floor()},this.setDrawingBufferSize=function(e,t,n){B=e,F=t,G=n,r.width=Math.floor(e*n),r.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(U)},this.getViewport=function(e){return e.copy(W)},this.setViewport=function(e,t,n,i){e.isVector4?W.set(e.x,e.y,e.z,e.w):W.set(e,t,n,i),oe.viewport(U.copy(W).multiplyScalar(G).floor())},this.getScissor=function(e){return e.copy(j)},this.setScissor=function(e,t,n,i){e.isVector4?j.set(e.x,e.y,e.z,e.w):j.set(e,t,n,i),oe.scissor(O.copy(j).multiplyScalar(G).floor())},this.getScissorTest=function(){return q},this.setScissorTest=function(e){oe.setScissorTest(q=e)},this.setOpaqueSort=function(e){V=e},this.setTransparentSort=function(e){H=e},this.getClearColor=function(e){return e.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor.apply(Me,arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha.apply(Me,arguments)},this.clear=function(){var e=0;(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(e|=16384),(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(e|=256),(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(e|=1024),ke.clear(e)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){r.removeEventListener("webglcontextlost",Ue,!1),r.removeEventListener("webglcontextrestored",Ne,!1),r.removeEventListener("webglcontextcreationerror",Oe,!1),ge.dispose(),ye.dispose(),ue.dispose(),ce.dispose(),he.dispose(),fe.dispose(),Ae.dispose(),Ee.dispose(),ve.dispose(),De.dispose(),De.removeEventListener("sessionstart",Fe),De.removeEventListener("sessionend",Ge),$&&($.dispose(),$=null),Ve.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=ne);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(e,t,n,i,r){!0!==t.isScene&&(t=ne),le.resetTextureUnits();var a=t.fog,o=i.isMeshStandardMaterial?t.environment:null,s=null===P?E.outputEncoding:!0===P.isXRRenderTarget?P.texture.encoding:fn,u=(i.isMeshStandardMaterial?he:ce).get(i.envMap||o),l=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!i.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,f=i.toneMapped?E.toneMapping:Le,v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==v?v.length:0,g=ue.get(i),y=w.state.lights;if(!0===K&&(!0===Q||e!==D)){var x=e===D&&i.id===I;xe.setState(i,e,x)}var _=!1;i.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version?_=!0:g.outputEncoding!==s?_=!0:r.isInstancedMesh&&!1===g.instancing?_=!0:r.isInstancedMesh||!0!==g.instancing?r.isSkinnedMesh&&!1===g.skinning?_=!0:r.isSkinnedMesh||!0!==g.skinning?g.envMap!==u?_=!0:!0===i.fog&&g.fog!==a?_=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===xe.numPlanes&&g.numIntersection===xe.numIntersection?g.vertexAlphas!==l?_=!0:g.vertexTangents!==c?_=!0:g.morphTargets!==h?_=!0:g.morphNormals!==d?_=!0:g.morphColors!==p?_=!0:g.toneMapping!==f?_=!0:!0===ae.isWebGL2&&g.morphTargetsCount!==m&&(_=!0):_=!0:_=!0:_=!0:(_=!0,g.__version=i.version);var M=g.currentProgram;!0===_&&(M=qe(i,t,r));var b=!1,S=!1,T=!1,A=M.getUniforms(),k=g.uniforms;if(oe.useProgram(M.program)&&(b=!0,S=!0,T=!0),i.id!==I&&(I=i.id,S=!0),b||D!==e){if(A.setValue(ke,"projectionMatrix",e.projectionMatrix),ae.logarithmicDepthBuffer&&A.setValue(ke,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),D!==e&&(D=e,S=!0,T=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){var C=A.map.cameraPosition;void 0!==C&&C.setValue(ke,te.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&A.setValue(ke,"isOrthographic",!0===e.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&A.setValue(ke,"viewMatrix",e.matrixWorldInverse)}if(r.isSkinnedMesh){A.setOptional(ke,r,"bindMatrix"),A.setOptional(ke,r,"bindMatrixInverse");var L=r.skeleton;L&&(ae.floatVertexTextures?(null===L.boneTexture&&L.computeBoneTexture(),A.setValue(ke,"boneTexture",L.boneTexture,le),A.setValue(ke,"boneTextureSize",L.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var R,U,N=n.morphAttributes;if((void 0!==N.position||void 0!==N.normal||void 0!==N.color&&!0===ae.isWebGL2)&&be.update(r,n,M),(S||g.receiveShadow!==r.receiveShadow)&&(g.receiveShadow=r.receiveShadow,A.setValue(ke,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(k.envMap.value=u,k.flipEnvMap.value=u.isCubeTexture&&!1===u.isRenderTargetTexture?-1:1),S&&(A.setValue(ke,"toneMappingExposure",E.toneMappingExposure),g.needsLights&&(U=T,(R=k).ambientLightColor.needsUpdate=U,R.lightProbe.needsUpdate=U,R.directionalLights.needsUpdate=U,R.directionalLightShadows.needsUpdate=U,R.pointLights.needsUpdate=U,R.pointLightShadows.needsUpdate=U,R.spotLights.needsUpdate=U,R.spotLightShadows.needsUpdate=U,R.rectAreaLights.needsUpdate=U,R.hemisphereLights.needsUpdate=U),a&&!0===i.fog&&me.refreshFogUniforms(k,a),me.refreshMaterialUniforms(k,i,G,F,$),sh.upload(ke,g.uniformsList,k,le)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(sh.upload(ke,g.uniformsList,k,le),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&A.setValue(ke,"center",r.center),A.setValue(ke,"modelViewMatrix",r.modelViewMatrix),A.setValue(ke,"normalMatrix",r.normalMatrix),A.setValue(ke,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial)for(var O=i.uniformsGroups,z=0,B=O.length;z0&&function(e,t,n,i){if(null===$){var r=ae.isWebGL2;$=new Zi(1024,1024,{generateMipmaps:!0,type:re.has("EXT_color_buffer_half_float")?ut:tt,minFilter:$e,samples:r&&!0===f?4:0})}var a=E.getRenderTarget();E.setRenderTarget($),E.clear();var o=E.toneMapping;E.toneMapping=Le,We(e,n,i),le.updateMultisampleRenderTarget($),le.updateRenderTargetMipmap($);for(var s=!1,u=0,l=t.length;u0&&We(r,t,n),a.length>0&&We(a,t,n),o.length>0&&We(o,t,n),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function We(e,t,n){for(var i=!0===t.isScene?t.overrideMaterial:null,r=0,a=e.length;r0?A[A.length-1]:null,T.pop(),S=T.length>0?T[T.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return L},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(e,t,n){ue.get(e.texture).__webglTexture=t,ue.get(e.depthTexture).__webglTexture=n;var i=ue.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===re.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=ue.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;P=e,C=t,L=n;var i=!0,r=null,a=!1,o=!1;if(e){var s=ue.get(e);void 0!==s.__useDefaultFramebuffer?(oe.bindFramebuffer(36160,null),i=!1):void 0===s.__webglFramebuffer?le.setupRenderTarget(e):s.__hasExternalTextures&&le.rebindTextures(e,ue.get(e.texture).__webglTexture,ue.get(e.depthTexture).__webglTexture);var u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(o=!0);var l=ue.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=l[t],a=!0):r=ae.isWebGL2&&e.samples>0&&!1===le.useMultisampledRTT(e)?ue.get(e).__webglMultisampledFramebuffer:l,U.copy(e.viewport),O.copy(e.scissor),z=e.scissorTest}else U.copy(W).multiplyScalar(G).floor(),O.copy(j).multiplyScalar(G).floor(),z=q;if(oe.bindFramebuffer(36160,r)&&ae.drawBuffers&&i&&oe.drawBuffers(e,r),oe.viewport(U),oe.scissor(O),oe.setScissorTest(z),a){var c=ue.get(e.texture);ke.framebufferTexture2D(36160,36064,34069+t,c.__webglTexture,n)}else if(o){var h=ue.get(e.texture),d=t||0;ke.framebufferTextureLayer(36160,36064,h.__webglTexture,n||0,d)}I=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=ue.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){oe.bindFramebuffer(36160,s);try{var u=e.texture,l=u.format,c=u.type;if(l!==pt&&Te.convert(l)!==ke.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===ut&&(re.has("EXT_color_buffer_half_float")||ae.isWebGL2&&re.has("EXT_color_buffer_float"));if(!(c===tt||Te.convert(c)===ke.getParameter(35738)||c===st&&(ae.isWebGL2||re.has("OES_texture_float")||re.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ke.readPixels(t,n,i,r,Te.convert(l),Te.convert(c),a)}finally{var d=null!==P?ue.get(P).__webglFramebuffer:null;oe.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i);le.setTexture2D(t,0),ke.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,a),oe.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=t.image.width,a=t.image.height,o=Te.convert(n.format),s=Te.convert(n.type);le.setTexture2D(n,0),ke.pixelStorei(37440,n.flipY),ke.pixelStorei(37441,n.premultiplyAlpha),ke.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ke.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?ke.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ke.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&ke.generateMipmap(3553),oe.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(E.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,u=e.max.z-e.min.z+1,l=Te.convert(i.format),c=Te.convert(i.type);if(i.isData3DTexture)le.setTexture3D(i,0),a=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");le.setTexture2DArray(i,0),a=35866}ke.pixelStorei(37440,i.flipY),ke.pixelStorei(37441,i.premultiplyAlpha),ke.pixelStorei(3317,i.unpackAlignment);var h=ke.getParameter(3314),d=ke.getParameter(32878),p=ke.getParameter(3316),f=ke.getParameter(3315),v=ke.getParameter(32877),m=n.isCompressedTexture?n.mipmaps[0]:n.image;ke.pixelStorei(3314,m.width),ke.pixelStorei(32878,m.height),ke.pixelStorei(3316,e.min.x),ke.pixelStorei(3315,e.min.y),ke.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ke.texSubImage3D(a,r,t.x,t.y,t.z,o,s,u,l,c,m.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ke.compressedTexSubImage3D(a,r,t.x,t.y,t.z,o,s,u,l,m.data)):ke.texSubImage3D(a,r,t.x,t.y,t.z,o,s,u,l,c,m),ke.pixelStorei(3314,h),ke.pixelStorei(32878,d),ke.pixelStorei(3316,p),ke.pixelStorei(3315,f),ke.pixelStorei(32877,v),0===r&&i.generateMipmaps&&ke.generateMipmap(a),oe.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?le.setTextureCube(e,0):e.isData3DTexture?le.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?le.setTexture2DArray(e,0):le.setTexture2D(e,0),oe.unbindTexture()},this.resetState=function(){C=0,L=0,P=null,oe.reset(),Ae.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))},[{key:"physicallyCorrectLights",get:function(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}])}(),fd=exports.WebGL1Renderer=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,pd),I(t)}();fd.prototype.isWebGL1Renderer=!0;var vd,md=exports.FogExp2=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;R(this,e),this.isFogExp2=!0,this.name="",this.color=new ba(t),this.density=n}return I(e,[{key:"clone",value:function(){return new e(this.color,this.density)}},{key:"toJSON",value:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}])}(),gd=exports.Fog=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;R(this,e),this.isFog=!0,this.name="",this.color=new ba(t),this.near=n,this.far=i}return I(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}])}(),yd=exports.Scene=function(e){function t(){var e;return R(this,t),(e=x(this,t)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:e})),e}return w(t,ia),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return null!==this.fog&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(n.object.backgroundIntensity=this.backgroundIntensity),n}},{key:"autoUpdate",get:function(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate},set:function(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}])}(),xd=exports.InterleavedBuffer=function(){return I(function e(t,n){R(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Fn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ii()},[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ii()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ii()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}])}(),_d=new nr,Md=exports.InterleavedBufferAttribute=function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];R(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=i,this.normalized=r}return I(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;te.far||t.push({distance:s,point:Sd.clone(),uv:va.getInterpolation(Sd,Cd,Ld,Rd,Pd,Id,Dd,new Ai),face:null,object:this})}}},{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}])}();function Nd(e,t,n,i,r,a){Ad.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Ed.x=a*Ad.x-r*Ad.y,Ed.y=r*Ad.x+a*Ad.y):Ed.copy(Ad),e.copy(t),e.x+=Ed.x,e.y+=Ed.y,e.applyMatrix4(kd)}var Od=new nr,zd=new nr,Bd=exports.LOD=function(e){function t(){var e;return R(this,t),(e=x(this,t))._currentLevel=0,e.type="LOD",Object.defineProperties(e,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}return w(t,ia),I(t,[{key:"copy",value:function(e){m(t,"copy",this,3)([e,!1]);for(var n=e.levels,i=0,r=n.length;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=Math.abs(t);var i,r=this.levels;for(i=0;i0){var n,i;for(n=1,i=t.length;n0){Od.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Od);this.getObjectForDistance(n).raycast(e,t)}}},{key:"update",value:function(e){var t=this.levels;if(t.length>1){Od.setFromMatrixPosition(e.matrixWorld),zd.setFromMatrixPosition(this.matrixWorld);var n,i,r=Od.distanceTo(zd)/e.zoom;for(t[0].object.visible=!0,n=1,i=t.length;n=a))break;t[n-1].object.visible=!1,t[n].object.visible=!0}for(this._currentLevel=n-1;n0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:je,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:je,d=arguments.length>10?arguments[10]:void 0,p=arguments.length>11?arguments[11]:void 0;return R(this,t),(e=x(this,t,[null,s,u,l,c,h,a,o,d,p])).isDataTexture=!0,e.image={data:n,width:i,height:r},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return w(t,Xi),I(t)}(),Zd=new Pr,Jd=new Pr,Kd=exports.Skeleton=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];R(this,e),this.uuid=ii(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return I(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,i=this.bones.length;n3&&void 0!==arguments[3]?arguments[3]:1;return R(this,t),(r=x(this,t,[e,n,i])).isInstancedBufferAttribute=!0,r.meshPerAttribute=a,r}return w(t,Pa),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}])}(),$d=new Pr,ep=new Pr,tp=[],np=new ar,ip=new Pr,rp=new vo,ap=new Sr,op=exports.InstancedMesh=function(e){function t(e,n,i){var r;R(this,t),(r=x(this,t,[e,n])).isInstancedMesh=!0,r.instanceMatrix=new Qd(new Float32Array(16*i),16),r.instanceColor=null,r.count=i,r.boundingBox=null,r.boundingSphere=null;for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:new Ja,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new sp;return R(this,t),(e=x(this,t)).isLine=!0,e.type="Line",e.geometry=n,e.material=i,e.updateMorphTargets(),e}return w(t,ia),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;is)){h.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(h);xe.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var _=Math.max(0,a.start),M=Math.min(f.count,a.start+a.count)-1;_s)){h.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(h);be.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i0&&void 0!==arguments[0]?arguments[0]:new Ja,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yp;return R(this,t),(e=x(this,t)).isPoints=!0,e.type="Points",e.geometry=n,e.material=i,e.updateMorphTargets(),e}return w(t,ia),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Mp.copy(n.boundingSphere),Mp.applyMatrix4(i),Mp.radius+=r,!1!==e.ray.intersectsSphere(Mp)){xp.copy(i).invert(),_p.copy(e.ray).applyMatrix4(xp);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=n.index,l=n.attributes.position;if(null!==u)for(var c=Math.max(0,a.start),h=Math.min(u.count,a.start+a.count);c0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;ir.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:u,index:t,face:null,object:o})}}var Tp=exports.VideoTexture=function(e){function t(e,n,i,r,a,o,s,u,l){var c;R(this,t),(c=x(this,t,[e,n,i,r,a,o,s,u,l])).isVideoTexture=!0,c.minFilter=void 0!==o?o:Je,c.magFilter=void 0!==a?a:Je,c.generateMipmaps=!1;var h=c;return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)}),c}return w(t,Xi),I(t,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}])}(),Ap=exports.FramebufferTexture=function(e){function t(e,n,i){var r;return R(this,t),(r=x(this,t,[{width:e,height:n}])).isFramebufferTexture=!0,r.format=i,r.magFilter=je,r.minFilter=je,r.generateMipmaps=!1,r.needsUpdate=!0,r}return w(t,Xi),I(t)}(),Ep=exports.CompressedTexture=function(e){function t(e,n,i,r,a,o,s,u,l,c,h,d){var p;return R(this,t),(p=x(this,t,[null,o,s,u,l,c,r,a,h,d])).isCompressedTexture=!0,p.image={width:n,height:i},p.mipmaps=e,p.flipY=!1,p.generateMipmaps=!1,p}return w(t,Xi),I(t)}(),kp=exports.CompressedArrayTexture=function(e){function t(e,n,i,r,a,o){var s;return R(this,t),(s=x(this,t,[e,n,i,a,o])).isCompressedArrayTexture=!0,s.image.depth=r,s.wrapR=He,s}return w(t,Ep),I(t)}(),Cp=exports.CanvasTexture=function(e){function t(e,n,i,r,a,o,s,u,l){var c;return R(this,t),(c=x(this,t,[e,n,i,r,a,o,s,u,l])).isCanvasTexture=!0,c.needsUpdate=!0,c}return w(t,Xi),I(t)}(),Lp=exports.Curve=function(){return I(function e(){R(this,e),this.type="Curve",this.arcLengthDivisions=200},[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],i=this.getPoint(0),r=0;n.push(0);for(var a=1;a<=e;a++)r+=(t=this.getPoint(a/e)).distanceTo(i),n.push(r),i=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,u=a-1;s<=u;)if((o=i[r=Math.floor(s+(u-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){u=r;break}u=r-1}if(i[r=u]===n)return r/(a-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new Ai:new nr);return o.copy(a).sub(r).normalize(),o}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new nr,i=[],r=[],a=[],o=new nr,s=new Pr,u=0;u<=e;u++){var l=u/e;i[u]=this.getTangentAt(l,new nr)}r[0]=new nr,a[0]=new nr;var c=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(var f=1;f<=e;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(ri(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(s.makeRotationAxis(o,v))}a[f].crossVectors(i[f],r[f])}if(!0===t){var m=Math.acos(ri(r[0].dot(r[e]),-1,1));m/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(m=-m);for(var g=1;g<=e;g++)r[g].applyMatrix4(s.makeRotationAxis(i[g],m*g)),a[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}])}(),Rp=exports.EllipseCurve=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return R(this,t),(e=x(this,t)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=n,e.aY=i,e.xRadius=r,e.yRadius=a,e.aStartAngle=o,e.aEndAngle=s,e.aClockwise=u,e.aRotation=l,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e,t){for(var n=t||new Ai,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;r0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return R(this,t),(e=x(this,t)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=n,e.closed=i,e.curveType=r,e.tension=a,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr,r=this.points,a=r.length,o=(a-(this.closed?0:1))*e,s=Math.floor(o),u=o-s;this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/a)+1)*a:0===u&&s===a-1&&(s=a-2,u=1),this.closed||s>0?t=r[(s-1)%a]:(Dp.subVectors(r[0],r[1]).add(r[0]),t=Dp);var l=r[s%a],c=r[(s+1)%a];if(this.closed||s+20&&void 0!==arguments[0]?arguments[0]:new Ai,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ai,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Ai;return R(this,t),(e=x(this,t)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=n,e.v1=i,e.v2=r,e.v3=a,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai,n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(Yp(e,n.x,i.x,r.x,a.x),Yp(e,n.y,i.y,r.y,a.y)),t}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}])}(),Jp=exports.CubicBezierCurve3=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new nr,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new nr;return R(this,t),(e=x(this,t)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=n,e.v1=i,e.v2=r,e.v3=a,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr,n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(Yp(e,n.x,i.x,r.x,a.x),Yp(e,n.y,i.y,r.y,a.y),Yp(e,n.z,i.z,r.z,a.z)),t}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}])}(),Kp=exports.LineCurve=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ai,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai;return R(this,t),(e=x(this,t)).isLineCurve=!0,e.type="LineCurve",e.v1=n,e.v2=i,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai).subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}])}(),Qp=exports.LineCurve3=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr;return R(this,t),(e=x(this,t)).isLineCurve3=!0,e.type="LineCurve3",e.v1=n,e.v2=i,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr).subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}])}(),$p=exports.QuadraticBezierCurve=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ai,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ai;return R(this,t),(e=x(this,t)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=n,e.v1=i,e.v2=r,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai,n=this.v0,i=this.v1,r=this.v2;return t.set(Hp(e,n.x,i.x,r.x),Hp(e,n.y,i.y,r.y)),t}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}])}(),ef=exports.QuadraticBezierCurve3=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new nr;return R(this,t),(e=x(this,t)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=n,e.v1=i,e.v2=r,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr,n=this.v0,i=this.v1,r=this.v2;return t.set(Hp(e,n.x,i.x,r.x),Hp(e,n.y,i.y,r.y),Hp(e,n.z,i.z,r.z)),t}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}])}(),tf=exports.SplineCurve=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return R(this,t),(e=x(this,t)).isSplineCurve=!0,e.type="SplineCurve",e.points=n,e}return w(t,Lp),I(t,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai,n=this.points,i=(n.length-1)*e,r=Math.floor(i),a=i-r,o=n[0===r?r:r-1],s=n[r],u=n[r>n.length-2?n.length-1:r+1],l=n[r>n.length-3?n.length-1:r+2];return t.set(Bp(a,o.x,s.x,u.x,l.x),Bp(a,o.y,s.y,u.y,l.y)),t}},{key:"copy",value:function(e){m(t,"copy",this,3)([e]),this.points=[];for(var n=0,i=e.points.length;n=n){var a=i[r]-n,o=this.curves[r],s=o.getLength(),u=0===s?0:1-a/s;return o.getPointAt(u,t)}r++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],i=0,r=this.curves;i1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){m(t,"copy",this,3)([e]),this.curves=[];for(var n=0,i=e.curves.length;n0){var l=u.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(u);var c=u.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=m(t,"toJSON",this,3)([]);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return m(t,"fromJSON",this,3)([e]),this.currentPoint.fromArray(e.currentPoint),this}}])}(),of=exports.LatheGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new Ai(0,-.5),new Ai(.5,0),new Ai(0,.5)],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;R(this,t),(e=x(this,t)).type="LatheGeometry",e.parameters={points:n,segments:i,phiStart:r,phiLength:a},i=Math.floor(i),a=ri(a,0,2*Math.PI);for(var o=[],s=[],u=[],l=[],c=[],h=1/i,d=new nr,p=new Ai,f=new nr,v=new nr,m=new nr,g=0,y=0,_=0;_<=n.length-1;_++)switch(_){case 0:g=n[_+1].x-n[_].x,y=n[_+1].y-n[_].y,f.x=1*y,f.y=-g,f.z=0*y,m.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case n.length-1:l.push(m.x,m.y,m.z);break;default:g=n[_+1].x-n[_].x,y=n[_+1].y-n[_].y,f.x=1*y,f.y=-g,f.z=0*y,v.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),l.push(f.x,f.y,f.z),m.copy(v)}for(var M=0;M<=i;M++)for(var b=r+M*h*a,S=Math.sin(b),w=Math.cos(b),T=0;T<=n.length-1;T++){d.x=n[T].x*S,d.y=n[T].y,d.z=n[T].x*w,s.push(d.x,d.y,d.z),p.x=M/i,p.y=T/(n.length-1),u.push(p.x,p.y);var A=l[3*T+0]*S,E=l[3*T+1],k=l[3*T+0]*w;c.push(A,E,k)}for(var C=0;C0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8;R(this,t);var o=new af;return o.absarc(0,-i/2,n,1.5*Math.PI,0),o.absarc(0,i/2,n,0,.5*Math.PI),(e=x(this,t,[o.getPoints(r),a])).type="CapsuleGeometry",e.parameters={radius:n,height:i,capSegments:r,radialSegments:a},e}return w(t,of),I(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.length,e.capSegments,e.radialSegments)}}])}(),uf=exports.CircleGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;R(this,t),(e=x(this,t)).type="CircleGeometry",e.parameters={radius:n,segments:i,thetaStart:r,thetaLength:a},i=Math.max(3,i);var o=[],s=[],u=[],l=[],c=new nr,h=new Ai;s.push(0,0,0),u.push(0,0,1),l.push(.5,.5);for(var d=0,p=3;d<=i;d++,p+=3){var f=r+d/i*a;c.x=n*Math.cos(f),c.y=n*Math.sin(f),s.push(c.x,c.y,c.z),u.push(0,0,1),h.x=(s[p]/n+1)/2,h.y=(s[p+1]/n+1)/2,l.push(h.x,h.y)}for(var v=1;v<=i;v++)o.push(v,v+1,0);return e.setIndex(o),e.setAttribute("position",new Ga(s,3)),e.setAttribute("normal",new Ga(u,3)),e.setAttribute("uv",new Ga(l,2)),e}return w(t,Ja),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new t(e.radius,e.segments,e.thetaStart,e.thetaLength)}}])}(),lf=exports.CylinderGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;R(this,t),(e=x(this,t)).type="CylinderGeometry",e.parameters={radiusTop:n,radiusBottom:i,height:r,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:u,thetaLength:l};var c=e;a=Math.floor(a),o=Math.floor(o);var h=[],d=[],p=[],f=[],v=0,m=[],g=r/2,y=0;function _(e){for(var t=v,r=new Ai,o=new nr,s=0,m=!0===e?n:i,x=!0===e?1:-1,_=1;_<=a;_++)d.push(0,g*x,0),p.push(0,x,0),f.push(.5,.5),v++;for(var M=v,b=0;b<=a;b++){var S=b/a*l+u,w=Math.cos(S),T=Math.sin(S);o.x=m*T,o.y=g*x,o.z=m*w,d.push(o.x,o.y,o.z),p.push(0,x,0),r.x=.5*w+.5,r.y=.5*T*x+.5,f.push(r.x,r.y),v++}for(var A=0;A0&&_(!0),i>0&&_(!1)),e.setIndex(h),e.setAttribute("position",new Ga(d,3)),e.setAttribute("normal",new Ga(p,3)),e.setAttribute("uv",new Ga(f,2)),e}return w(t,Ja),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new t(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}])}(),cf=exports.ConeGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return R(this,t),(e=x(this,t,[0,n,i,r,a,o,s,u])).type="ConeGeometry",e.parameters={radius:n,height:i,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:u},e}return w(t,lf),I(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}])}(),hf=exports.PolyhedronGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;R(this,t),(e=x(this,t)).type="PolyhedronGeometry",e.parameters={vertices:n,indices:i,radius:r,detail:a};var o=[],s=[];function u(e,t,n,i){for(var r=i+1,a=[],o=0;o<=r;o++){a[o]=[];for(var s=e.clone().lerp(n,o/r),u=t.clone().lerp(n,o/r),c=r-o,h=0;h<=c;h++)a[o][h]=0===h&&o===r?s:s.clone().lerp(u,h/c)}for(var d=0;d.9&&a<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),e.setAttribute("position",new Ga(o,3)),e.setAttribute("normal",new Ga(o.slice(),3)),e.setAttribute("uv",new Ga(s,2)),0===a?e.computeVertexNormals():e.normalizeNormals(),e}return w(t,Ja),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new t(e.vertices,e.indices,e.radius,e.details)}}])}(),df=exports.DodecahedronGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(this,t);var r=(1+Math.sqrt(5))/2,a=1/r;return(e=x(this,t,[[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-a,-r,0,-a,r,0,a,-r,0,a,r,-a,-r,0,-a,r,0,a,-r,0,a,r,0,-r,0,-a,r,0,-a,-r,0,a,r,0,a],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],n,i])).type="DodecahedronGeometry",e.parameters={radius:n,detail:i},e}return w(t,hf),I(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}])}(),pf=new nr,ff=new nr,vf=new nr,mf=new va,gf=exports.EdgesGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(R(this,t),(e=x(this,t)).type="EdgesGeometry",e.parameters={geometry:n,thresholdAngle:i},null!==n){for(var r=Math.pow(10,4),a=Math.cos(ti*i),o=n.getIndex(),s=n.getAttribute("position"),u=o?o.count:s.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),d={},p=[],f=0;f2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*l:e.length,d=_f(e,0,h,l,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=Ef(e,t,d,l)),e.length>80*l){n=r=e[0],i=a=e[1];for(var f=l;fr&&(r=o),s>a&&(a=s);u=0!==(u=Math.max(r-n,a-i))?32767/u:0}return bf(d,p,l,n,i,u,0),p}};function _f(e,t,n,i,r){var a,o;if(r===Jf(e,t,n,i)>0)for(a=t;a=t;a-=i)o=Xf(a,e[a],e[a+1],o);return o&&Bf(o,o.next)&&(Yf(o),o=o.next),o}function Mf(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!Bf(i,i.next)&&0!==zf(i.prev,i,i.next))i=i.next;else{if(Yf(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function bf(e,t,n,i,r,a,o){if(e){!o&&a&&Pf(e,i,r,a);for(var s,u,l=e;e.prev!==e.next;)if(s=e.prev,u=e.next,a?wf(e,i,r,a):Sf(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),Yf(e),e=u.next,l=u.next;else if((e=u)===l){o?1===o?bf(e=Tf(Mf(e),t,n),t,n,i,r,a,2):2===o&&Af(e,t,n,i,r,a):bf(Mf(e),t,n,i,r,a,1);break}}}function Sf(e){var t=e.prev,n=e,i=e.next;if(zf(t,n,i)>=0)return!1;for(var r=t.x,a=n.x,o=i.x,s=t.y,u=n.y,l=i.y,c=ra?r>o?r:o:a>o?a:o,p=s>u?s>l?s:l:u>l?u:l,f=i.next;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&Nf(r,s,a,u,o,l,f.x,f.y)&&zf(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function wf(e,t,n,i){var r=e.prev,a=e,o=e.next;if(zf(r,a,o)>=0)return!1;for(var s=r.x,u=a.x,l=o.x,c=r.y,h=a.y,d=o.y,p=su?s>l?s:l:u>l?u:l,m=c>h?c>d?c:d:h>d?h:d,g=Df(p,f,t,n,i),y=Df(v,m,t,n,i),x=e.prevZ,_=e.nextZ;x&&x.z>=g&&_&&_.z<=y;){if(x.x>=p&&x.x<=v&&x.y>=f&&x.y<=m&&x!==r&&x!==o&&Nf(s,c,u,h,l,d,x.x,x.y)&&zf(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,_.x>=p&&_.x<=v&&_.y>=f&&_.y<=m&&_!==r&&_!==o&&Nf(s,c,u,h,l,d,_.x,_.y)&&zf(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=v&&x.y>=f&&x.y<=m&&x!==r&&x!==o&&Nf(s,c,u,h,l,d,x.x,x.y)&&zf(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;_&&_.z<=y;){if(_.x>=p&&_.x<=v&&_.y>=f&&_.y<=m&&_!==r&&_!==o&&Nf(s,c,u,h,l,d,_.x,_.y)&&zf(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Tf(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!Bf(r,a)&&Ff(r,i,i.next,a)&&Wf(r,a)&&Wf(a,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(a.i/n|0),Yf(i),Yf(i.next),i=e=a),i=i.next}while(i!==e);return Mf(i)}function Af(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Of(o,s)){var u=qf(o,s);return o=Mf(o,o.next),u=Mf(u,u.next),bf(o,t,n,i,r,a,0),void bf(u,t,n,i,r,a,0)}s=s.next}o=o.next}while(o!==e)}function Ef(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=a&&s>r&&(r=s,n=i.x=i.x&&i.x>=c&&a!==i.x&&Nf(on.x||i.x===n.x&&Rf(n,i)))&&(n=i,d=u)),i=i.next}while(i!==l);return n}function Rf(e,t){return zf(e.prev,e,t.prev)<0&&zf(t.next,e,e.next)<0}function Pf(e,t,n,i){var r=e;do{0===r.z&&(r.z=Df(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,If(r)}function If(e){var t,n,i,r,a,o,s,u,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t0||u>0&&i;)0!==s&&(0===u||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,u--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,l*=2}while(o>1);return e}function Df(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Uf(e){var t=e,n=e;do{(t.x=(e-o)*(a-s)&&(e-o)*(i-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(r-o)*(i-s)}function Of(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Hf(e,t)&&(Wf(e,t)&&Wf(t,e)&&jf(e,t)&&(zf(e.prev,e,t.prev)||zf(e,t.prev,t))||Bf(e,t)&&zf(e.prev,e,e.next)>0&&zf(t.prev,t,t.next)>0)}function zf(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Bf(e,t){return e.x===t.x&&e.y===t.y}function Ff(e,t,n,i){var r=Vf(zf(e,t,n)),a=Vf(zf(e,t,i)),o=Vf(zf(n,i,e)),s=Vf(zf(n,i,t));return r!==a&&o!==s||(!(0!==r||!Gf(e,n,t))||(!(0!==a||!Gf(e,i,t))||(!(0!==o||!Gf(n,e,i))||!(0!==s||!Gf(n,t,i)))))}function Gf(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Vf(e){return e>0?1:e<0?-1:0}function Hf(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Ff(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Wf(e,t){return zf(e.prev,e,e.next)<0?zf(e,t,e.next)>=0&&zf(e,e.prev,t)>=0:zf(e,t,e.prev)<0||zf(e,e.next,t)<0}function jf(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}function qf(e,t){var n=new Zf(e.i,e.x,e.y),i=new Zf(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Xf(e,t,n,i){var r=new Zf(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Yf(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Zf(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Jf(e,t,n,i){for(var r=0,a=t,o=n-i;a2&&e[t-1].equals(e[0])&&e.pop()}function $f(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:new yf([new Ai(.5,.5),new Ai(-.5,.5),new Ai(-.5,-.5),new Ai(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};R(this,t),(e=x(this,t)).type="ExtrudeGeometry",e.parameters={shapes:n,options:i},n=Array.isArray(n)?n:[n];for(var r=e,a=[],o=[],s=0,u=n.length;sNumber.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(u*u+l*l),f=t.x-s/d,v=t.y+o/d,m=((n.x-l/p-f)*l-(n.y+u/p-v)*u)/(o*l-s*u),g=(i=f+o*m-e.x)*i+(r=v+s*m-e.y)*r;if(g<=2)return new Ai(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?u>Number.EPSILON&&(y=!0):o<-Number.EPSILON?u<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(c)):(i=o,r=s,a=Math.sqrt(c/2))}return new Ai(i/a,r/a)}for(var O=[],z=0,B=C.length,F=B-1,G=z+1;z=0;ge--){for(var ye=ge/y,xe=v*Math.cos(ye*Math.PI/2),_e=m*Math.sin(ye*Math.PI/2)+g,Me=0,be=C.length;Me=0;){var i=n,r=n-1;r<0&&(r=e.length-1);for(var a=0,o=d+2*y;a0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(this,t);var r=(1+Math.sqrt(5))/2;return(e=x(this,t,[[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],n,i])).type="IcosahedronGeometry",e.parameters={radius:n,detail:i},e}return w(t,hf),I(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}])}(),rv=exports.OctahedronGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(this,t);return(e=x(this,t,[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],n,i])).type="OctahedronGeometry",e.parameters={radius:n,detail:i},e}return w(t,hf),I(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}])}(),av=exports.RingGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;R(this,t),(e=x(this,t)).type="RingGeometry",e.parameters={innerRadius:n,outerRadius:i,thetaSegments:r,phiSegments:a,thetaStart:o,thetaLength:s},r=Math.max(3,r);for(var u=[],l=[],c=[],h=[],d=n,p=(i-n)/(a=Math.max(1,a)),f=new nr,v=new Ai,m=0;m<=a;m++){for(var g=0;g<=r;g++){var y=o+g/r*s;f.x=d*Math.cos(y),f.y=d*Math.sin(y),l.push(f.x,f.y,f.z),c.push(0,0,1),v.x=(f.x/i+1)/2,v.y=(f.y/i+1)/2,h.push(v.x,v.y)}d+=p}for(var _=0;_0&&void 0!==arguments[0]?arguments[0]:new yf([new Ai(0,.5),new Ai(-.5,-.5),new Ai(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;R(this,t),(e=x(this,t)).type="ShapeGeometry",e.parameters={shapes:n,curveSegments:i};var r=[],a=[],o=[],s=[],u=0,l=0;if(!1===Array.isArray(n))h(n);else for(var c=0;c0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;R(this,t),(e=x(this,t)).type="SphereGeometry",e.parameters={radius:n,widthSegments:i,heightSegments:r,phiStart:a,phiLength:o,thetaStart:s,thetaLength:u},i=Math.max(3,Math.floor(i)),r=Math.max(2,Math.floor(r));for(var l=Math.min(s+u,Math.PI),c=0,h=[],d=new nr,p=new nr,f=[],v=[],m=[],g=[],y=0;y<=r;y++){var _=[],M=y/r,b=0;0===y&&0===s?b=.5/i:y===r&&l===Math.PI&&(b=-.5/i);for(var S=0;S<=i;S++){var w=S/i;d.x=-n*Math.cos(a+w*o)*Math.sin(s+M*u),d.y=n*Math.cos(s+M*u),d.z=n*Math.sin(a+w*o)*Math.sin(s+M*u),v.push(d.x,d.y,d.z),p.copy(d).normalize(),m.push(p.x,p.y,p.z),g.push(w+b,1-M),_.push(c++)}h.push(_)}for(var T=0;T0)&&f.push(E,k,L),(T!==r-1||l0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(this,t);return(e=x(this,t,[[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],n,i])).type="TetrahedronGeometry",e.parameters={radius:n,detail:i},e}return w(t,hf),I(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}])}(),cv=exports.TorusGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:48,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;R(this,t),(e=x(this,t)).type="TorusGeometry",e.parameters={radius:n,tube:i,radialSegments:r,tubularSegments:a,arc:o},r=Math.floor(r),a=Math.floor(a);for(var s=[],u=[],l=[],c=[],h=new nr,d=new nr,p=new nr,f=0;f<=r;f++)for(var v=0;v<=a;v++){var m=v/a*o,g=f/r*Math.PI*2;d.x=(n+i*Math.cos(g))*Math.cos(m),d.y=(n+i*Math.cos(g))*Math.sin(m),d.z=i*Math.sin(g),u.push(d.x,d.y,d.z),h.x=n*Math.cos(m),h.y=n*Math.sin(m),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),c.push(v/a),c.push(f/r)}for(var y=1;y<=r;y++)for(var _=1;_<=a;_++){var M=(a+1)*y+_-1,b=(a+1)*(y-1)+_-1,S=(a+1)*(y-1)+_,w=(a+1)*y+_;s.push(M,b,w),s.push(b,S,w)}return e.setIndex(s),e.setAttribute("position",new Ga(u,3)),e.setAttribute("normal",new Ga(l,3)),e.setAttribute("uv",new Ga(c,2)),e}return w(t,Ja),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new t(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}])}(),hv=exports.TorusKnotGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;R(this,t),(e=x(this,t)).type="TorusKnotGeometry",e.parameters={radius:n,tube:i,tubularSegments:r,radialSegments:a,p:o,q:s},r=Math.floor(r),a=Math.floor(a);for(var u=[],l=[],c=[],h=[],d=new nr,p=new nr,f=new nr,v=new nr,m=new nr,g=new nr,y=new nr,_=0;_<=r;++_){var M=_/r*o*Math.PI*2;I(M,o,s,n,f),I(M+.01,o,s,n,v),g.subVectors(v,f),y.addVectors(v,f),m.crossVectors(g,y),y.crossVectors(m,g),m.normalize(),y.normalize();for(var b=0;b<=a;++b){var S=b/a*Math.PI*2,w=-i*Math.cos(S),T=i*Math.sin(S);d.x=f.x+(w*y.x+T*m.x),d.y=f.y+(w*y.y+T*m.y),d.z=f.z+(w*y.z+T*m.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),c.push(p.x,p.y,p.z),h.push(_/r),h.push(b/a)}}for(var A=1;A<=r;A++)for(var E=1;E<=a;E++){var k=(a+1)*(A-1)+(E-1),C=(a+1)*A+(E-1),L=(a+1)*A+E,P=(a+1)*(A-1)+E;u.push(k,C,P),u.push(C,L,P)}function I(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,u=Math.cos(s);r.x=i*(2+u)*.5*a,r.y=i*(2+u)*o*.5,r.z=i*Math.sin(s)*.5}return e.setIndex(u),e.setAttribute("position",new Ga(l,3)),e.setAttribute("normal",new Ga(c,3)),e.setAttribute("uv",new Ga(h,2)),e}return w(t,Ja),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new t(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}])}(),dv=exports.TubeGeometry=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ef(new nr(-1,-1,0),new nr(-1,1,0),new nr(1,1,0)),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];R(this,t),(e=x(this,t)).type="TubeGeometry",e.parameters={path:n,tubularSegments:i,radius:r,radialSegments:a,closed:o};var s=n.computeFrenetFrames(i,o);e.tangents=s.tangents,e.normals=s.normals,e.binormals=s.binormals;var u=new nr,l=new nr,c=new Ai,h=new nr,d=[],p=[],f=[],v=[];function m(e){h=n.getPointAt(e/i,h);for(var t=s.normals[e],o=s.binormals[e],c=0;c<=a;c++){var f=c/a*Math.PI*2,v=Math.sin(f),m=-Math.cos(f);l.x=m*t.x+v*o.x,l.y=m*t.y+v*o.y,l.z=m*t.z+v*o.z,l.normalize(),p.push(l.x,l.y,l.z),u.x=h.x+r*l.x,u.y=h.y+r*l.y,u.z=h.z+r*l.z,d.push(u.x,u.y,u.z)}}return function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:null;if(R(this,t),(e=x(this,t)).type="WireframeGeometry",e.parameters={geometry:n},null!==n){var i=[],r=new Set,a=new nr,o=new nr;if(null!==n.index){var s=n.attributes.position,u=n.index,l=n.groups;0===l.length&&(l=[{start:0,count:u.count,materialIndex:0}]);for(var c=0,h=l.length;c0!=e>0&&this.version++,this._sheen=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=i(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}])}(),_v=exports.MeshPhongMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshPhongMaterial=!0,n.type="MeshPhongMaterial",n.color=new ba(16777215),n.specular=new ba(1118481),n.shininess=30,n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new ba(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=yn,n.normalScale=new Ai(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=Ee,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.flatShading=!1,n.fog=!0,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}])}(),Mv=exports.MeshToonMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshToonMaterial=!0,n.defines={TOON:""},n.type="MeshToonMaterial",n.color=new ba(16777215),n.map=null,n.gradientMap=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new ba(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=yn,n.normalScale=new Ai(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.alphaMap=null,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.fog=!0,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}])}(),bv=exports.MeshNormalMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshNormalMaterial=!0,n.type="MeshNormalMaterial",n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=yn,n.normalScale=new Ai(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.flatShading=!1,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}])}(),Sv=exports.MeshLambertMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshLambertMaterial=!0,n.type="MeshLambertMaterial",n.color=new ba(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new ba(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=yn,n.normalScale=new Ai(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=Ee,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.flatShading=!1,n.fog=!0,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}])}(),wv=exports.MeshMatcapMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isMeshMatcapMaterial=!0,n.defines={MATCAP:""},n.type="MeshMatcapMaterial",n.color=new ba(16777215),n.matcap=null,n.map=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=yn,n.normalScale=new Ai(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.alphaMap=null,n.flatShading=!1,n.fog=!0,n.setValues(e),n}return w(t,ga),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}])}(),Tv=exports.LineDashedMaterial=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).isLineDashedMaterial=!0,n.type="LineDashedMaterial",n.scale=1,n.dashSize=3,n.gapSize=1,n.setValues(e),n}return w(t,sp),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}])}();function Av(e,t,n){return kv(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function Ev(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function kv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Cv(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n}function Lv(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,u=0;u!==t;++u)r[o++]=e[s+u];return r}function Rv(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}}function Pv(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var o=[],s=0;s=i)){c.push(u.times[d]);for(var f=0;fa.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;i<=0&&(i=30);for(var r=n.tracks.length,a=t/i,o=function(){var t=n.tracks[s],i=t.ValueTypeName;if("bool"===i||"string"===i)return 0;var r=e.tracks.find(function(e){return e.name===t.name&&e.ValueTypeName===i});if(void 0===r)return 0;var o=0,u=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=u/3);var l=0,c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=c/3);var h,d=t.times.length-1;if(a<=t.times[0]){var p=o,f=u-o;h=Av(t.values,p,f)}else if(a>=t.times[d]){var v=d*u+o,m=v+u-o;h=Av(t.values,v,m)}else{var g=t.createInterpolant(),y=o,x=u-o;g.evaluate(a),h=Av(g.resultBuffer,y,x)}"quaternion"===i&&(new tr).fromArray(h).normalize().conjugate().toArray(h);for(var _=r.times.length,M=0;M<_;++M){var b=M*c+l;if("quaternion"===i)tr.multiplyQuaternionsFlat(r.values,b,h,0,r.values,b);else for(var S=c-2*l,w=0;w=r)break e;var s=t[1];e=(r=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Av(n,r,a),this.values=Av(this.values,r*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&kv(i))for(var u=0,l=i.length;u!==l;++u){var c=i[u];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,u,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=Av(this.times),t=Av(this.values),n=this.getValueSize(),i=this.getInterpolation()===an,r=e.length-1,a=1,o=1;o0){e[a]=e[r];for(var g=r*n,y=a*n,x=0;x!==n;++x)t[y+x]=t[g+x];++a}return a!==e.length?(this.times=Av(e,0,a),this.values=Av(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=Av(this.times,0),t=Av(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Ev(e.times,Array),values:Ev(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}])}();Bv.prototype.TimeBufferType=Float32Array,Bv.prototype.ValueBufferType=Float32Array,Bv.prototype.DefaultInterpolation=rn;var Fv=exports.BooleanKeyframeTrack=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,Bv),I(t)}();Fv.prototype.ValueTypeName="bool",Fv.prototype.ValueBufferType=Array,Fv.prototype.DefaultInterpolation=nn,Fv.prototype.InterpolantFactoryMethodLinear=void 0,Fv.prototype.InterpolantFactoryMethodSmooth=void 0;var Gv=exports.ColorKeyframeTrack=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,Bv),I(t)}();Gv.prototype.ValueTypeName="color";var Vv=exports.NumberKeyframeTrack=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,Bv),I(t)}();Vv.prototype.ValueTypeName="number";var Hv=exports.QuaternionLinearInterpolant=function(e){function t(e,n,i,r){return R(this,t),x(this,t,[e,n,i,r])}return w(t,Uv),I(t,[{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t),u=e*o,l=u+o;u!==l;u+=4)tr.slerpFlat(r,0,a,u-o,a,u,s);return r}}])}(),Wv=exports.QuaternionKeyframeTrack=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,Bv),I(t,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new Hv(this.times,this.values,this.getValueSize(),e)}}])}();Wv.prototype.ValueTypeName="quaternion",Wv.prototype.DefaultInterpolation=rn,Wv.prototype.InterpolantFactoryMethodSmooth=void 0;var jv=exports.StringKeyframeTrack=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,Bv),I(t)}();jv.prototype.ValueTypeName="string",jv.prototype.ValueBufferType=Array,jv.prototype.DefaultInterpolation=nn,jv.prototype.InterpolantFactoryMethodLinear=void 0,jv.prototype.InterpolantFactoryMethodSmooth=void 0;var qv=exports.VectorKeyframeTrack=function(e){function t(){return R(this,t),x(this,t,arguments)}return w(t,Bv),I(t)}();qv.prototype.ValueTypeName="vector";var Xv=exports.AnimationClip=function(){return I(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ln;R(this,e),this.name=t,this.tracks=i,this.duration=n,this.blendMode=r,this.uuid=ii(),this.duration<0&&this.resetDuration()},[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e1){var l=u[1],c=i[l];c||(i[l]=c=[]),c.push(s)}}var h=[];for(var d in i)h.push(this.CreateFromMorphTargetSequence(d,i[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Rv(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,u=e.hierarchy||[],l=0;l1&&void 0!==arguments[1]?arguments[1]:1;return R(this,t),(n=x(this,t)).isLight=!0,n.type="Light",n.color=new ba(e),n.intensity=i,n}return w(t,ia),I(t,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,void 0!==this.groundColor&&(n.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(n.object.distance=this.distance),void 0!==this.angle&&(n.object.angle=this.angle),void 0!==this.decay&&(n.object.decay=this.decay),void 0!==this.penumbra&&(n.object.penumbra=this.penumbra),void 0!==this.shadow&&(n.object.shadow=this.shadow.toJSON()),n}}])}(),hm=exports.HemisphereLight=function(e){function t(e,n,i){var r;return R(this,t),(r=x(this,t,[e,i])).isHemisphereLight=!0,r.type="HemisphereLight",r.position.copy(ia.DEFAULT_UP),r.updateMatrix(),r.groundColor=new ba(n),r}return w(t,cm),I(t,[{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.groundColor.copy(e.groundColor),this}}])}(),dm=new Pr,pm=new nr,fm=new nr,vm=function(){return I(function e(t){R(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ai(512,512),this.map=null,this.mapPass=null,this.matrix=new Pr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fo,this._frameExtents=new Ai(1,1),this._viewportCount=1,this._viewports=[new Yi(0,0,1,1)]},[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;pm.setFromMatrixPosition(e.matrixWorld),t.position.copy(pm),fm.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(fm),t.updateMatrixWorld(),dm.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(dm),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(dm)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}])}(),mm=function(e){function t(){var e;return R(this,t),(e=x(this,t,[new ko(50,1,.5,500)])).isSpotLightShadow=!0,e.focus=1,e}return w(t,vm),I(t,[{key:"updateMatrices",value:function(e){var n=this.camera,i=2*ni*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,a=e.distance||n.far;i===n.fov&&r===n.aspect&&a===n.far||(n.fov=i,n.aspect=r,n.far=a,n.updateProjectionMatrix()),m(t,"updateMatrices",this,3)([e])}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.focus=e.focus,this}}])}(),gm=exports.SpotLight=function(e){function t(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return R(this,t),(i=x(this,t,[e,n])).isSpotLight=!0,i.type="SpotLight",i.position.copy(ia.DEFAULT_UP),i.updateMatrix(),i.target=new ia,i.distance=r,i.angle=a,i.penumbra=o,i.decay=s,i.map=null,i.shadow=new mm,i}return w(t,cm),I(t,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}])}(),ym=new Pr,xm=new nr,_m=new nr,Mm=function(e){function t(){var e;return R(this,t),(e=x(this,t,[new ko(90,1,.5,500)])).isPointLightShadow=!0,e._frameExtents=new Ai(4,2),e._viewportCount=6,e._viewports=[new Yi(2,1,1,1),new Yi(0,1,1,1),new Yi(3,1,1,1),new Yi(1,1,1,1),new Yi(3,0,1,1),new Yi(1,0,1,1)],e._cubeDirections=[new nr(1,0,0),new nr(-1,0,0),new nr(0,0,1),new nr(0,0,-1),new nr(0,1,0),new nr(0,-1,0)],e._cubeUps=[new nr(0,1,0),new nr(0,1,0),new nr(0,1,0),new nr(0,1,0),new nr(0,0,1),new nr(0,0,-1)],e}return w(t,vm),I(t,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),xm.setFromMatrixPosition(e.matrixWorld),n.position.copy(xm),_m.copy(n.position),_m.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(_m),n.updateMatrixWorld(),i.makeTranslation(-xm.x,-xm.y,-xm.z),ym.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ym)}}])}(),bm=exports.PointLight=function(e){function t(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return R(this,t),(i=x(this,t,[e,n])).isPointLight=!0,i.type="PointLight",i.distance=r,i.decay=a,i.shadow=new Mm,i}return w(t,cm),I(t,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}])}(),Sm=function(e){function t(){var e;return R(this,t),(e=x(this,t,[new Cl(-5,5,5,-5,.5,500)])).isDirectionalLightShadow=!0,e}return w(t,vm),I(t)}(),wm=exports.DirectionalLight=function(e){function t(e,n){var i;return R(this,t),(i=x(this,t,[e,n])).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(ia.DEFAULT_UP),i.updateMatrix(),i.target=new ia,i.shadow=new Sm,i}return w(t,cm),I(t,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}])}(),Tm=exports.AmbientLight=function(e){function t(e,n){var i;return R(this,t),(i=x(this,t,[e,n])).isAmbientLight=!0,i.type="AmbientLight",i}return w(t,cm),I(t)}(),Am=exports.RectAreaLight=function(e){function t(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return R(this,t),(i=x(this,t,[e,n])).isRectAreaLight=!0,i.type="RectAreaLight",i.width=r,i.height=a,i}return w(t,cm),I(t,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return n.object.width=this.width,n.object.height=this.height,n}}])}(),Em=exports.SphericalHarmonics3=function(){return I(function e(){R(this,e),this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new nr)},[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}])}(),km=exports.LightProbe=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Em,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return R(this,t),(e=x(this,t,[void 0,i])).isLightProbe=!0,e.sh=n,e}return w(t,cm),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.sh.copy(e.sh),this}},{key:"fromJSON",value:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return n.object.sh=this.sh.toArray(),n}}])}(),Cm=exports.MaterialLoader=function(e){function t(e){var n;return R(this,t),(n=x(this,t,[e])).textures={},n}return w(t,em),I(t,[{key:"load",value:function(e,t,n,i){var r=this,a=new im(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(a){i?i(a):console.error(a),r.manager.itemError(e)}},n,i)}},{key:"parse",value:function(e){var n=this.textures;function i(e){return void 0===n[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),n[e]}var r=t.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=(new ba).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(r.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var a in e.uniforms){var o=e.uniforms[a];switch(r.uniforms[a]={},o.type){case"t":r.uniforms[a].value=i(o.value);break;case"c":r.uniforms[a].value=(new ba).setHex(o.value);break;case"v2":r.uniforms[a].value=(new Ai).fromArray(o.value);break;case"v3":r.uniforms[a].value=(new nr).fromArray(o.value);break;case"v4":r.uniforms[a].value=(new Yi).fromArray(o.value);break;case"m3":r.uniforms[a].value=(new Ei).fromArray(o.value);break;case"m4":r.uniforms[a].value=(new Pr).fromArray(o.value);break;default:r.uniforms[a].value=o.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(var s in e.extensions)r.extensions[s]=e.extensions[s];if(void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=i(e.map)),void 0!==e.matcap&&(r.matcap=i(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=i(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=i(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=i(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var u=e.normalScale;!1===Array.isArray(u)&&(u=[u,u]),r.normalScale=(new Ai).fromArray(u)}return void 0!==e.displacementMap&&(r.displacementMap=i(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=i(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=i(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=i(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=i(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=i(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=i(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=i(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=i(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=i(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=i(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=i(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new Ai).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=i(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=i(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=i(e.thicknessMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=i(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}},{key:"setTextures",value:function(e){return this.textures=e,this}}],[{key:"createMaterialFromType",value:function(e){return new{ShadowMaterial:mv,SpriteMaterial:bd,RawShaderMaterial:gv,ShaderMaterial:Ao,PointsMaterial:yp,MeshPhysicalMaterial:xv,MeshStandardMaterial:yv,MeshPhongMaterial:_v,MeshToonMaterial:Mv,MeshNormalMaterial:bv,MeshLambertMaterial:Sv,MeshDepthMaterial:Jh,MeshDistanceMaterial:Kh,MeshBasicMaterial:wa,MeshMatcapMaterial:wv,LineDashedMaterial:Tv,LineBasicMaterial:sp,Material:ga}[e]}}])}(),Lm=exports.LoaderUtils=function(){return I(function e(){R(this,e)},null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n0){var o=new Qv(t);(n=new om(o)).setCrossOrigin(this.crossOrigin);for(var s=0,u=e.length;s0)){e.n=9;break}(r=new om(this.manager)).setCrossOrigin(this.crossOrigin),s=0,l=t.length;case 1:if(!(s2&&void 0!==arguments[2]?arguments[2]:1;R(this,t),(i=x(this,t,[void 0,r])).isHemisphereLightProbe=!0;var a=(new ba).set(e),o=(new ba).set(n),s=new nr(a.r,a.g,a.b),u=new nr(o.r,o.g,o.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);return i.sh.coefficients[0].copy(s).add(u).multiplyScalar(l),i.sh.coefficients[1].copy(s).sub(u).multiplyScalar(c),i}return w(t,km),I(t)}(),Gm=exports.AmbientLightProbe=function(e){function t(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;R(this,t),(n=x(this,t,[void 0,i])).isAmbientLightProbe=!0;var r=(new ba).set(e);return n.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI)),n}return w(t,km),I(t)}(),Vm=new Pr,Hm=new Pr,Wm=new Pr,jm=exports.StereoCamera=function(){return I(function e(){R(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ko,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ko,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}},[{key:"update",value:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Wm.copy(e.projectionMatrix);var n,i,r=t.eyeSep/2,a=r*t.near/t.focus,o=t.near*Math.tan(ti*t.fov*.5)/t.zoom;Hm.elements[12]=-r,Vm.elements[12]=r,n=-o*t.aspect+a,i=o*t.aspect+a,Wm.elements[0]=2*t.near/(i-n),Wm.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(Wm),n=-o*t.aspect-a,i=o*t.aspect-a,Wm.elements[0]=2*t.near/(i-n),Wm.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(Wm)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Hm),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Vm)}}])}(),qm=exports.Clock=function(){return I(function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];R(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},[{key:"start",value:function(){this.startTime=Xm(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Xm();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}])}();function Xm(){return("undefined"==typeof performance?Date:performance).now()}var Ym=new nr,Zm=new tr,Jm=new nr,Km=new nr,Qm=exports.AudioListener=function(e){function t(){var e;return R(this,t),(e=x(this,t)).type="AudioListener",e.context=zm.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new qm,e}return w(t,ia),I(t,[{key:"getInput",value:function(){return this.gain}},{key:"removeFilter",value:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}},{key:"getFilter",value:function(){return this.filter}},{key:"setFilter",value:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}},{key:"getMasterVolume",value:function(){return this.gain.gain.value}},{key:"setMasterVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},{key:"updateMatrixWorld",value:function(e){m(t,"updateMatrixWorld",this,3)([e]);var n=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ym,Zm,Jm),Km.set(0,0,-1).applyQuaternion(Zm),n.positionX){var r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Ym.x,r),n.positionY.linearRampToValueAtTime(Ym.y,r),n.positionZ.linearRampToValueAtTime(Ym.z,r),n.forwardX.linearRampToValueAtTime(Km.x,r),n.forwardY.linearRampToValueAtTime(Km.y,r),n.forwardZ.linearRampToValueAtTime(Km.z,r),n.upX.linearRampToValueAtTime(i.x,r),n.upY.linearRampToValueAtTime(i.y,r),n.upZ.linearRampToValueAtTime(i.z,r)}else n.setPosition(Ym.x,Ym.y,Ym.z),n.setOrientation(Km.x,Km.y,Km.z,i.x,i.y,i.z)}}])}(),$m=exports.Audio=function(e){function t(e){var n;return R(this,t),(n=x(this,t)).type="Audio",n.listener=e,n.context=e.context,n.gain=n.context.createGain(),n.gain.connect(e.getInput()),n.autoplay=!1,n.buffer=null,n.detune=0,n.loop=!1,n.loopStart=0,n.loopEnd=0,n.offset=0,n.duration=void 0,n.playbackRate=1,n.isPlaying=!1,n.hasPlaybackControl=!0,n.source=null,n.sourceType="empty",n._startedAt=0,n._progress=0,n._connected=!1,n.filters=[],n}return w(t,ia),I(t,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}},{key:"pause",value:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"stop",value:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"connect",value:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e1&&void 0!==arguments[1]?arguments[1]:2048;R(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)},[{key:"getFrequencyData",value:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},{key:"getAverageFrequency",value:function(){for(var e=0,t=this.getFrequencyData(),n=0;n0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var u=t,l=t+t;u!==l;++u)if(n[u]!==n[u+t]){o.setValue(n,i);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,i){tr.slerpFlat(e,t,e,t,e,n,i)}},{key:"_slerpAdditive",value:function(e,t,n,i,r){var a=this._workIndex*r;tr.multiplyQuaternionsFlat(e,a,e,t,e,n),tr.slerpFlat(e,t,e,t,e,a,i)}},{key:"_lerp",value:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}},{key:"_lerpAdditive",value:function(e,t,n,i,r){for(var a=0;a!==r;++a){var o=t+a;e[o]=e[o]+e[n+a]*i}}}])}(),sg="\\[\\]\\.:\\/",ug=new RegExp("["+sg+"]","g"),lg="[^"+sg+"]",cg="[^"+sg.replace("\\.","")+"]",hg=/((?:WC+[\/:])*)/.source.replace("WC",lg),dg=/(WCOD+)?/.source.replace("WCOD",cg),pg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lg),fg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lg),vg=new RegExp("^"+hg+dg+pg+fg+"$"),mg=["material","materials","bones","map"],gg=function(){return I(function e(t,n,i){R(this,e);var r=i||yg.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,r)},[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}])}(),yg=exports.PropertyBinding=function(){function e(t,n,i){R(this,e),this.path=n,this.parsedPath=i||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return I(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,i=n.objectName,r=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var o=n.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s=r){var c=r++,h=e[c];t[h.uuid]=l,e[l]=h,t[u]=c,e[c]=s;for(var d=0,p=i;d!==p;++d){var f=n[d],v=f[c],m=f[l];f[l]=v,f[c]=m}}}this.nCachedObjects_=r}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var u=arguments[o].uuid,l=t[u];if(void 0!==l)if(delete t[u],l0&&(t[_.uuid]=l),e[l]=_,e.pop();for(var M=0,b=i;M!==b;++M){var S=n[M];S[l]=S[x],S.pop()}}}this.nCachedObjects_=r}},{key:"subscribe_",value:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,u=s.length,l=this.nCachedObjects_,c=new Array(u);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(c);for(var h=l,d=s.length;h!==d;++h){var p=s[h];c[h]=new yg(p,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}])}(),_g=exports.AnimationAction=function(){return I(function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;R(this,e),this._mixer=t,this._clip=n,this._localRoot=i,this.blendMode=r;for(var a=n.tracks,o=a.length,s=new Array(o),u={endingStart:on,endingEnd:on},l=0;l!==o;++l){var c=a[l].createInterpolant(null);s[l]=c,c.settings=u}this._interpolantSettings=u,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=en,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0},[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,u=o.sampleValues;return s[0]=r,s[1]=r+n,u[0]=e/a,u[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;a<0||0===n?t=0:(this._startTime=null,t=n*a)}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var u=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case cn:for(var c=0,h=u.length;c!==h;++c)u[c].evaluate(o),l[c].accumulateAdditive(s);break;case ln:default:for(var d=0,p=u.length;d!==p;++d)u[d].evaluate(o),l[d].accumulate(i,s)}}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=n===tn;if(0===e)return-1===r?i:a&&1==(1&r)?t-i:i;if(n===$t){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){var o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var u=e<0;this._setEndings(u,!u,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&1==(1&r))return t-i}return i}},{key:"_setEndings",value:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=sn,i.endingEnd=sn):(i.endingStart=e?this.zeroSlopeAtStart?sn:on:un,i.endingEnd=t?this.zeroSlopeAtEnd?sn:on:un)}},{key:"_scheduleFading",value:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}])}(),Mg=new Float32Array(1),bg=exports.AnimationMixer=function(e){function t(e){var n;return R(this,t),(n=x(this,t))._root=e,n._initMemoryManager(),n._accuIndex=0,n.time=0,n.timeScale=1,n}return w(t,Qn),I(t,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,u=this._bindingsByRootAndName,l=u[s];void 0===l&&(l={},u[s]=l);for(var c=0;c!==r;++c){var h=i[c],d=h.name,p=l[d];if(void 0!==p)++p.referenceCount,a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(p=new og(yg.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(i,e,r,a)}for(var s=this._bindings,u=this._nActiveBindings,l=0;l!==u;++l)s[l].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:1;return R(this,t),(i=x(this,t,[e,n])).isInstancedInterleavedBuffer=!0,i.meshPerAttribute=r,i}return w(t,xd),I(t,[{key:"copy",value:function(e){return m(t,"copy",this,3)([e]),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var n=m(t,"clone",this,3)([e]);return n.meshPerAttribute=this.meshPerAttribute,n}},{key:"toJSON",value:function(e){var n=m(t,"toJSON",this,3)([e]);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n}}])}(),Eg=exports.GLBufferAttribute=function(){return I(function e(t,n,i,r,a){R(this,e),this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=n,this.itemSize=i,this.elementSize=r,this.count=a,this.version=0},[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setBuffer",value:function(e){return this.buffer=e,this}},{key:"setType",value:function(e,t){return this.type=e,this.elementSize=t,this}},{key:"setItemSize",value:function(e){return this.itemSize=e,this}},{key:"setCount",value:function(e){return this.count=e,this}}])}(),kg=exports.Raycaster=function(){return I(function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;R(this,e),this.ray=new Rr(t,n),this.near=i,this.far=r,this.camera=null,this.layers=new Hr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}},[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Lg(e,this,n,t),n.sort(Cg),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=0,r=e.length;i0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return R(this,e),this.radius=t,this.phi=n,this.theta=i,this},[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ri(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),Pg=exports.Cylindrical=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return R(this,e),this.radius=t,this.theta=n,this.y=i,this},[{key:"set",value:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),Ig=new Ai,Dg=exports.Box2=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ai(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai(-1/0,-1/0);R(this,e),this.isBox2=!0,this.min=t,this.max=n},[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,Ig).distanceTo(e)}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}])}(),Ug=new nr,Ng=new nr,Og=exports.Line3=function(){return I(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr;R(this,e),this.start=t,this.end=n},[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){Ug.subVectors(e,this.start),Ng.subVectors(this.end,this.start);var n=Ng.dot(Ng),i=Ng.dot(Ug)/n;return t&&(i=ri(i,0,1)),i}},{key:"closestPointToPoint",value:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),zg=new nr,Bg=exports.SpotLightHelper=function(e){function t(e,n){var i;R(this,t),(i=x(this,t)).light=e,i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=n,i.type="SpotLightHelper";for(var r=new Ja,a=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],o=0,s=1;o<32;o++,s++){var u=o/32*Math.PI*2,l=s/32*Math.PI*2;a.push(Math.cos(u),Math.sin(u),1,Math.cos(l),Math.sin(l),1)}r.setAttribute("position",new Ga(a,3));var c=new sp({fog:!1,toneMapped:!1});return i.cone=new mp(r,c),i.add(i.cone),i.update(),i}return w(t,ia),I(t,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),zg.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(zg),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}])}(),Fg=new nr,Gg=new Pr,Vg=new Pr,Hg=exports.SkeletonHelper=function(e){function t(e){var n;R(this,t);for(var i=Wg(e),r=new Ja,a=[],o=[],s=new ba(0,0,1),u=new ba(0,1,0),l=0;l0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;R(this,t),r=new ba(r),a=new ba(a);for(var o=i/2,s=n/i,u=n/2,l=[],c=[],h=0,d=0,p=-u;h<=i;h++,p+=s){l.push(-u,0,p,u,0,p),l.push(p,0,-u,p,0,u);var f=h===o?r:a;f.toArray(c,d),d+=3,f.toArray(c,d),d+=3,f.toArray(c,d),d+=3,f.toArray(c,d),d+=3}var v=new Ja;return v.setAttribute("position",new Ga(l,3)),v.setAttribute("color",new Ga(c,3)),(e=x(this,t,[v,new sp({vertexColors:!0,toneMapped:!1})])).type="GridHelper",e}return w(t,mp),I(t,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}])}(),Kg=exports.PolarGridHelper=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;R(this,t),o=new ba(o),s=new ba(s);var u=[],l=[];if(i>1)for(var c=0;c1&&void 0!==arguments[1]?arguments[1]:16776960;R(this,t);var r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new Float32Array(24),o=new Ja;return o.setIndex(new Pa(r,1)),o.setAttribute("position",new Pa(a,3)),(n=x(this,t,[o,new sp({color:i,toneMapped:!1})])).object=e,n.type="BoxHelper",n.matrixAutoUpdate=!1,n.update(),n}return w(t,mp),I(t,[{key:"update",value:function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&uy.setFromObject(this.object),!uy.isEmpty()){var t=uy.min,n=uy.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}},{key:"setFromObject",value:function(e){return this.object=e,this.update(),this}},{key:"copy",value:function(e,n){return m(t,"copy",this,3)([e,n]),this.object=e.object,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}])}(),cy=exports.Box3Helper=function(e){function t(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;R(this,t);var r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new Ja;return a.setIndex(new Pa(r,1)),a.setAttribute("position",new Ga([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),(n=x(this,t,[a,new sp({color:i,toneMapped:!1})])).box=e,n.type="Box3Helper",n.geometry.computeBoundingSphere(),n}return w(t,mp),I(t,[{key:"updateMatrixWorld",value:function(e){var n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),m(t,"updateMatrixWorld",this,3)([e]))}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}])}(),hy=exports.PlaneHelper=function(e){function t(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960;R(this,t);var a=r,o=new Ja;o.setAttribute("position",new Ga([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),o.computeBoundingSphere(),(n=x(this,t,[o,new sp({color:a,toneMapped:!1})])).type="PlaneHelper",n.plane=e,n.size=i;var s=new Ja;return s.setAttribute("position",new Ga([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),n.add(new vo(s,new wa({color:a,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),n}return w(t,pp),I(t,[{key:"updateMatrixWorld",value:function(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),m(t,"updateMatrixWorld",this,3)([e])}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])}(),dy=new nr,py=exports.ArrowHelper=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nr(0,0,1),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nr(0,0,0),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*r,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*o;return R(this,t),(e=x(this,t)).type="ArrowHelper",void 0===oy&&((oy=new Ja).setAttribute("position",new Ga([0,0,0,0,1,0],3)),(sy=new lf(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(i),e.line=new pp(oy,new sp({color:a,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new vo(sy,new wa({color:a,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(n),e.setLength(r,o,s),e}return w(t,ia),I(t,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{dy.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(dy,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return m(t,"copy",this,3)([e,!1]),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}])}(),fy=exports.AxesHelper=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;R(this,t);var i=[0,0,0,n,0,0,0,0,0,0,n,0,0,0,0,0,0,n],r=new Ja;return r.setAttribute("position",new Ga(i,3)),r.setAttribute("color",new Ga([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),(e=x(this,t,[r,new sp({vertexColors:!0,toneMapped:!1})])).type="AxesHelper",e}return w(t,mp),I(t,[{key:"setColors",value:function(e,t,n){var i=new ba,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}])}(),vy=exports.ShapePath=function(){return I(function e(){R(this,e),this.type="ShapePath",this.color=new ba,this.subPaths=[],this.currentPath=null},[{key:"moveTo",value:function(e,t){return this.currentPath=new af,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e){function t(e,t){for(var n=t.length,i=!1,r=n-1,a=0;aNumber.EPSILON){if(l<0&&(o=t[a],u=-u,s=t[r],l=-l),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=l*(e.x-o.x)-u*(e.y-o.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var n,i,r,a=Kf.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return i=o[0],(r=new yf).curves=i.curves,s.push(r),s;var u=!a(o[0].getPoints());u=e?!u:u;var l,c,h=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var v=0,m=o.length;v1){for(var g=!1,y=0,x=0,_=d.length;x<_;x++)h[x]=[];for(var M=0,b=d.length;M0&&!1===g&&(p=h)}for(var k=0,C=d.length;k3?(o=v===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&yn||n>v)&&(i[4]=r,i[5]=n,s.n=v,u=0))}if(o||r>1)return c;throw p=!0,n}return function(o,l,v){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&y(l,v),u=l,a=v;(e=u<2?t:a)||!p;){i||(u?u<3?(u>1&&(s.n=-1),y(u,a)):s.n=a:s.v=a);try{if(f=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(p=s.n<0)?a:r.call(n,s))!==c)break}catch(e){i=t,u=1,a=e}finally{f=1}}return{value:e,done:p}}}(r,i,u),!0),l}var c={};function f(){}function l(){}function p(){}e=Object.getPrototypeOf;var s=[][i]?e(e([][i]())):(o(e={},i,function(){return this}),e),y=p.prototype=f.prototype=Object.create(s);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,u,"GeneratorFunction")),t.prototype=Object.create(y),t}return l.prototype=p,o(y,"constructor",p),o(p,"constructor",l),l.displayName="GeneratorFunction",o(p,u,"GeneratorFunction"),o(y),o(y,u,"Generator"),o(y,i,function(){return this}),o(y,"toString",function(){return"[object Generator]"}),(n=function(){return{w:a,m:v}})()}function o(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(o=function(t,e,r,n){if(e)i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r;else{function u(e,r){o(t,e,function(t){return this._invoke(e,r,t)})}u("next",0),u("throw",1),u("return",2)}})(t,e,r,n)}function i(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function a(t){i(u,n,o,a,c,"next",t)}function c(t){i(u,n,o,a,c,"throw",t)}a(void 0)})}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var r=0;r1&&void 0!==i[1]?i[1]:null,o=i.length>2&&void 0!==i[2]?i[2]:null,this.fileLoader.load(e,r,o);case 1:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"loadTexture",value:function(){var t=u(n().m(function t(e,r,o){var i=this;return n().w(function(t){for(;;)switch(t.n){case 0:fetch(e).then(function(t){if(!t.ok)throw new Error("Response is invalid");return t.blob()}).then(function(t){var e=URL.createObjectURL(t);i.textureLoader.load(e,function(t){r(t)})}).catch(function(t){o?o(t):console.error(t)});case 1:return t.a(2)}},t)}));return function(e,r,n){return t.apply(this,arguments)}}()}])}(); },{"three":"dKqR"}],"bj7I":[function(require,module,exports) { "use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null;if(this.active){var r=c();switch(e){case"error":console.error("".concat(r," - ").concat(t));break;default:console.log("".concat(r," - ").concat(t))}}}}])}();function c(){var t=new Date,e=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0"),n=String(t.getSeconds()).padStart(2,"0"),o=String(t.getMilliseconds()).padStart(2,"0");return"[".concat(e,":").concat(r,":").concat(n,":").concat(o,"]")} },{}],"gxPC":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Renderer=void 0;var e=t(require("three"));function t(e,n){if("function"==typeof WeakMap)var r=new WeakMap,i=new WeakMap;return(t=function(e,t){if(!t&&e&&e.__esModule)return e;var n,o,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(n=t?i:r){if(n.has(e))return n.get(e);n.set(e,a)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(o.get||o.set)?n(a,r,o):a[r]=e[r]);return a})(e,n)}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n-1&&this.renderCallbacks.splice(t,1)}}])}(),y=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}; },{"three":"dKqR"}],"CssJ":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RAD2DEG=exports.MathUtils=exports.DEG2RAD=void 0,exports.ceilPowerOfTwo=D,exports.clamp=n,exports.damp=f,exports.degToRad=x,exports.denormalize=y,exports.euclideanModulo=c,exports.floorPowerOfTwo=v,exports.generateUUID=o,exports.inverseLerp=d,exports.isPowerOfTwo=A,exports.lerp=u,exports.mapLinear=s,exports.normalize=E,exports.pingpong=i,exports.radToDeg=w,exports.randFloat=b,exports.randFloatSpread=M,exports.randInt=l,exports.seededRandom=m,exports.setQuaternionFromProperEuler=g,exports.smootherstep=h,exports.smoothstep=p;var e=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],r=1234567,t=exports.DEG2RAD=Math.PI/180,a=exports.RAD2DEG=180/Math.PI;function o(){var r=4294967295*Math.random()|0,t=4294967295*Math.random()|0,a=4294967295*Math.random()|0,o=4294967295*Math.random()|0;return(e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255]+"-"+e[255&t]+e[t>>8&255]+"-"+e[t>>16&15|64]+e[t>>24&255]+"-"+e[63&a|128]+e[a>>8&255]+"-"+e[a>>16&255]+e[a>>24&255]+e[255&o]+e[o>>8&255]+e[o>>16&255]+e[o>>24&255]).toLowerCase()}function n(e,r,t){return Math.max(r,Math.min(t,e))}function c(e,r){return(e%r+r)%r}function s(e,r,t,a,o){return a+(e-r)*(o-a)/(t-r)}function d(e,r,t){return e!==r?(t-e)/(r-e):0}function u(e,r,t){return(1-t)*e+t*r}function f(e,r,t,a){return u(e,r,1-Math.exp(-t*a))}function i(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return r-Math.abs(c(e,2*r)-r)}function p(e,r,t){return e<=r?0:e>=t?1:(e=(e-r)/(t-r))*e*(3-2*e)}function h(e,r,t){return e<=r?0:e>=t?1:(e=(e-r)/(t-r))*e*e*(e*(6*e-15)+10)}function l(e,r){return e+Math.floor(Math.random()*(r-e+1))}function b(e,r){return e+Math.random()*(r-e)}function M(e){return e*(.5-Math.random())}function m(e){void 0!==e&&(r=e);var t=r+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}function x(e){return e*t}function w(e){return e*a}function A(e){return 0==(e&e-1)&&0!==e}function D(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function v(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function g(e,r,t,a,o){var n=Math.cos,c=Math.sin,s=n(t/2),d=c(t/2),u=n((r+a)/2),f=c((r+a)/2),i=n((r-a)/2),p=c((r-a)/2),h=n((a-r)/2),l=c((a-r)/2);switch(o){case"XYX":e.set(s*f,d*i,d*p,s*u);break;case"YZY":e.set(d*p,s*f,d*i,s*u);break;case"ZXZ":e.set(d*i,d*p,s*f,s*u);break;case"XZX":e.set(s*f,d*l,d*h,s*u);break;case"YXY":e.set(d*h,s*f,d*l,s*u);break;case"ZYZ":e.set(d*l,d*h,s*f,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+o)}}function y(e,r){switch(r.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function E(e,r){switch(r.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var I=exports.MathUtils={DEG2RAD:t,RAD2DEG:a,generateUUID:o,clamp:n,euclideanModulo:c,mapLinear:s,inverseLerp:d,lerp:u,damp:f,pingpong:i,smoothstep:p,smootherstep:h,randInt:l,randFloat:b,randFloatSpread:M,seededRandom:m,degToRad:x,radToDeg:w,isPowerOfTwo:A,ceilPowerOfTwo:D,floorPowerOfTwo:v,setQuaternionFromProperEuler:g,normalize:E,denormalize:y}; },{}],"qIvE":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Camera=void 0;var t=e(require("three")),o=require("three/src/math/MathUtils");function e(t,o){if("function"==typeof WeakMap)var i=new WeakMap,r=new WeakMap;return(e=function(t,o){if(!o&&t&&t.__esModule)return t;var e,n,a={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return a;if(e=o?r:i){if(e.has(t))return e.get(t);e.set(t,a)}for(const i in t)"default"!==i&&{}.hasOwnProperty.call(t,i)&&((n=(e=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,i))&&(n.get||n.set)?e(a,i,n):a[i]=t[i]);return a})(t,o)}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function n(t,o){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null!==t&&(this.toPosition.x=t),null!==o&&(this.toPosition.y=o),null!==e&&(this.toPosition.z=e),(this.toRotation.z||this.camera.rotation.z)&&(this.rotationMatrix.extractRotation(this.camera.matrix),this.toPosition.applyMatrix4(this.rotationMatrix))}},{key:"rotateCamera",value:function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null!==t&&(this.toRotation.x=t*Math.PI/180),null!==o&&(this.toRotation.y=o*Math.PI/180),null!==e&&(this.toRotation.z=e*Math.PI/180)}},{key:"reset",value:function(){var t=l(p,this).width,o=l(p,this).height;this.camera.left=t/-2,this.camera.right=t/2,this.camera.bottom=o/-2,this.camera.top=o/2,this.camera.zoom=1,this.camera.position.set(0,0,10),this.camera.rotation.set(0,0,0),this.toZoom=1,this.toPosition.set(0,0,20),this.toRotation.set(0,0,0),this.camera.updateProjectionMatrix()}},{key:"render",value:function(t,o,e){var i=["x","y","z"],r=Math.min(.008*(e-this.lastTick),1),n=!1;this.lastTick=e;for(var a=0;a<3;++a)Math.abs(this.toPosition[i[a]]-this.camera.position[i[a]])>5e-4&&(this.camera.position[i[a]]+=(this.toPosition[i[a]]-this.camera.position[i[a]])*r,n=!0),Math.abs(this.toRotation[i[a]]-this.camera.rotation[i[a]])>5e-4&&(this.camera.rotation[i[a]]+=(this.toRotation[i[a]]-this.camera.rotation[i[a]])*r*.5,n=!0);Math.abs(this.toZoom-this.camera.zoom)>5e-4&&(this.camera.zoom+=(this.toZoom-this.camera.zoom)*r*.5,n=!0),n&&this.camera.updateProjectionMatrix()}}])}(); },{"three":"dKqR","three/src/math/MathUtils":"CssJ"}],"LhVm":[function(require,module,exports) { "use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n2&&void 0!==arguments[2])||arguments[2];if(!r||!r.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(e){if(e.normalized||e.isInterleavedBufferAttribute){for(var t=new Float32Array(e.getCount()*e.itemSize),r=0,o=0;r2&&(t[o++]=e.getZ(r));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}var n=t.index?t.toNonIndexed():t,a=r.generateTangents(i(n.attributes.position),i(n.attributes.normal),i(n.attributes.uv));if(o)for(var u=3;u1&&void 0!==arguments[1]&&arguments[1],i=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),u={},s={},f=t[0].morphTargetsRelative,l=new e.BufferGeometry,m=0,c=0;c=2&&r.setY(s,t.getY(s)),n>=3&&r.setZ(s,t.getZ(s)),n>=4&&r.setW(s,t.getW(s));return r}function u(e){var t=e.attributes,r=e.morphTargets,o=new Map;for(var i in t){var n=t[i];n.isInterleavedBufferAttribute&&(o.has(n)||o.set(n,a(n)),t[i]=o.get(n))}for(var u in r){var s=r[u];s.isInterleavedBufferAttribute&&(o.has(s)||o.set(s,a(s)),r[u]=o.get(s))}}function s(e){var t=0;for(var r in e.attributes){var o=e.getAttribute(r);t+=o.count*o.itemSize*o.array.BYTES_PER_ELEMENT}var i=e.getIndex();return t+=i?i.count*i.itemSize*i.array.BYTES_PER_ELEMENT:0}function f(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e-4;r=Math.max(r,Number.EPSILON);for(var o={},i=t.getIndex(),n=t.getAttribute("position"),a=i?i.count:n.count,u=0,s=Object.keys(t.attributes),f={},l={},m=[],c=["getX","getY","getZ","getW"],g=["setX","setY","setZ","setW"],d=0,b=s.length;d1&&void 0!==arguments[1]?arguments[1]:Math.PI/3,o=Math.cos(r),i=100*(1+1e-10),n=[new e.Vector3,new e.Vector3,new e.Vector3],a=new e.Vector3,u=new e.Vector3,s=new e.Vector3,f=new e.Vector3;function l(e){var t=~~(e.x*i),r=~~(e.y*i),o=~~(e.z*i);return"".concat(t,",").concat(r,",").concat(o)}for(var m=t.toNonIndexed(),c=m.attributes.position,g={},d=0,b=c.count/3;do&&f.add(H)}f.normalize(),E.setXYZ(G+V,f.x,f.y,f.z)}}return m.setAttribute("normal",E),m}function d(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),r(e,t)}function b(e){return console.warn("THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes()."),o(e)} },{"three":"dKqR"}],"KIAo":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("three/examples/jsm/utils/BufferGeometryUtils.js")),t=r(require("three"));function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(const n in e)"default"!==n&&{}.hasOwnProperty.call(e,n)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,n))&&(a.get||a.set)?r(i,n,a):i[n]=e[n]);return i})(e,t)}var n=exports.default=function(){function r(e,t,r,n){var o=e-r,a=t-n;return Math.sqrt(o*o+a*a)}return{imageMapToShape:function(n,o,a){var i,u,f,l,c,s,p,h,v,d,g,y,M=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"poly",m=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,b=[],w=[],_=o/2,T=a/2;if(i=new t.Shape,1!==m)for(var j=0;j10&&v>y?(i.lineTo(d,g),b.push(i),d=c,g=s,(i=new t.Shape).moveTo(c,s)):i.lineTo(c,s))}else i.lineTo(c,s);return b.push(i),b.forEach(function(e){var r=new t.ShapeGeometry(e,{depth:0,bevelEnabled:!1});w.push(r)}),e.mergeGeometries(w)},calcDistance:r,calcAngle:function(e,t,r,n){return 180*Math.atan2(t-n,e-r)/Math.PI},calcCentroid:function(e){var r,n,o=new t.Vector3;for(r=0,n=e.length;r0&&(i.material.opacity-=.05))})}},{key:"update",value:function(e){var t=this;if(this.active!=e.active){this.active=e.active;var i=h(p,this);h(f,this).scene.children.forEach(function(e){e instanceof i.Mesh&&e.userData.uniqueId===t.sectorId&&(t.active?(e.material.color=h(m,t).colors.sectorOverlay,e.material.opacity=0):(e.material.color=h(m,t).colors.sectorDisabled,e.material.opacity=.6),e.material.needsUpdate=!0)})}this.price=e.price,this.availableSeats=e.total,this.selectTicket=e.selectTicket,this.maximumTickets=e.maximumTickets}}])}(); },{"../Utils/shape":"KIAo"}],"Q1A5":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubSector=void 0;var t=e(require("../Utils/shape"));function e(t){return t&&t.__esModule?t:{default:t}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i0&&(t.material.opacity-=.05))}},{key:"update",value:function(t){this.active!==t.active&&this.changeStatus(t.active),this.availableSeats=t.total}},{key:"changeStatus",value:function(t){this.active=t,this.mesh&&(t?(this.mesh.toOpacity=.2,this.mesh.material.color=h(m,this).colors.subSectorOverlay):(this.mesh.toOpacity=.6,this.mesh.material.color=h(m,this).colors.subSectorDisabled),this.mesh.material.needsUpdate=!0)}}])}(); },{"../Utils/shape":"KIAo"}],"hTvo":[function(require,module,exports) { "use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var o=0;o1&&void 0!==arguments[1]&&arguments[1];e(this,t),this.seatId=o.ing_codigo,this.status=o.sti_codigo,this.ing_codigo=o.ing_codigo,this.eel_lugar=o.eel_lugar,this.eei_nome=o.eei_nome,this.tle_codigo=o.tle_codigo,this.tee_aviso=o.tee_aviso,this.tee_texto=o.tee_texto,this.parentId=o.eei_codigo_pai,this.userBooked=i},[{key:"updateData",value:function(t,e){var o=!1;if(this.status!=t.sti_codigo&&(o=!0),this.userBooked!=e&&(o=!0),o){this.status=t.sti_codigo,this.userBooked=e;var i=new CustomEvent("seatStatusUpdate",{detail:{seatId:this.seatId,status:this.status,userBooked:this.userBooked}});document.dispatchEvent(i)}}}])}(); },{}],"BSLE":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Stadium=void 0;var t=n(require("three")),e=require("./background"),i=require("./sector"),r=require("./subSector"),s=require("./seat");function n(t,e){if("function"==typeof WeakMap)var i=new WeakMap,r=new WeakMap;return(n=function(t,e){if(!e&&t&&t.__esModule)return t;var s,n,o={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return o;if(s=e?r:i){if(s.has(t))return s.get(t);s.set(t,o)}for(const i in t)"default"!==i&&{}.hasOwnProperty.call(t,i)&&((n=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,i))&&(n.get||n.set)?s(o,i,n):o[i]=t[i]);return o})(t,e)}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:null,i=c(f,this).update;i&&i[t]&&(r?(n=new URL(i[t],window.location.origin)).search=new URLSearchParams(r).toString():n=i[t],fetch(n).then(function(t){return t.json()}).then(function(t){return e(t)}).catch(function(t){return console.error(t)}))}}])}(); },{}],"Jdsl":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Intersects=r;var e=t(require("three"));function t(e,r){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(t=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,c={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return c;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,c)}for(const n in e)"default"!==n&&{}.hasOwnProperty.call(e,n)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,n))&&(a.get||a.set)?r(c,n,a):c[n]=e[n]);return c})(e,r)}function r(t,r,n){var o,a,c,i={},u=new e.Raycaster;return i.mouseFromCamera=(o=new e.Matrix4,a=new e.Vector3,function(e,t){return a.set(e,t,0),o.copy(n.camera.matrixWorld).invert(),a.applyMatrix4(o)}),i.mouseIntersects=(c=new e.Vector2,function(o,a,i,f){c.x=o/r.clientWidth*2-1,c.y=-a/r.clientHeight*2+1,u.setFromCamera(c,n.camera);var s=t.children.filter(function(t){return t instanceof e.Mesh&&!0===t.userData.interceptable}),l=u.intersectObjects(s),p=0;return s.forEach(function(e){var t=!1;l.find(function(t){return t.object===e})&&(t=!0,p++),t?i&&i(e,!0):f&&f(e,!1)}),p}),i} },{"three":"dKqR"}],"bdU0":[function(require,module,exports) { "use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0]?this.containerElement.prepend(this.element):this.containerElement.appendChild(this.element)}},{key:"parseHTML",value:function(e){var t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}}])}(); },{}],"widE":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Tooltip=void 0;var t=require("./UIComponent");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];n(this,o);return(e=s(this,o,[t])).element=e.parseHTML('
\n\t\t\t
\t\n \n
\n\t\t\t\t
\n\t\t\t\t
\n \tCadeiras disponíveis: \n\t\t\t\t
\n
\n
'),e.tooltipImage=e.element.querySelector("img"),e.tooltipTitle=e.element.querySelector(".sector-name"),e.availableSeats=e.element.querySelector(".available-seats"),e.append(!1),e.uniqueId=null,e.showTicketAmount=r,e}return y(o,t.UIComponent),r(o,[{key:"set",value:function(t,e,n,o){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(this.uniqueId!=t){this.uniqueId=t,this.element.style.opacity="1",this.element.style.transform="scale(1, 1)",this.tooltipTitle.textContent=e;var i=this.element.querySelector(".seats"),l=this.element.querySelector(".price");this.showTicketAmount?(i.style.display="block",i.querySelector(".available-seats").textContent=n||"Esgotado"):i.style.display="none",o?(this.tooltipImage.style.display="block",this.tooltipImage.src=o):(this.tooltipImage.style.display="none",this.tooltipImage.removeAttribute("src")),r?(l.style.display="block",l.textContent="R$ "+r):l.style.display="none"}}},{key:"hide",value:function(){this.uniqueId=null,this.element.style.opacity="0",this.element.style.transform="scale(1, 0)"}},{key:"move",value:function(t,e){var n=this.element.clientWidth,o=this.element.clientHeight,r=t-(n+50),i=e-3*o/4,l=document.clientWidth,s=document.clientHeight;r<10&&(r=10),i<10&&(i=10),r+n>l&&(r=l-n+10),i+o>s&&(i=s-o+10),this.element.style.left="".concat(r,"px"),this.element.style.top="".concat(i,"px")}}])}(); },{"./UIComponent":"bdU0"}],"fIWy":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SeatsModal=void 0;var t=require("./UIComponent");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return s(t)||r(t)||i(t)||o()}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function r(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t){if(Array.isArray(t))return a(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n\n \n \n '),e.modalContent=e.element.querySelector(".modal-content"),e.seatTooltip=e.element.querySelector(".seat-tooltip"),e.seatsRows=e.element.querySelector(".seats-rows ul"),e.seatsList=e.element.querySelector(".seats-list"),e.append(),e.seatStatusClass=["seat-disabled","seat-active","seat-disabled","seat-sold"],e.scale=1,e}return b(o,t.UIComponent),u(o,[{key:"init",value:function(){this.element.addEventListener("wheel",this.onZoom.bind(this)),this.seatsList.addEventListener("mouseover",this.onMouseOver.bind(this)),this.seatsList.addEventListener("mouseout",this.onMouseOut.bind(this)),this.seatsList.addEventListener("click",this.onClick.bind(this))}},{key:"onZoom",value:function(t){t.preventDefault();var e=this.element.querySelector(".scroll-container"),n=event.deltaY>0?.2:-.3,o=Math.max(.7,Math.min(this.scale+n,1.1));this.scale=o,e.style.transform="scale(".concat(o,",").concat(o,")"),this.element.style.setProperty("--xs-seatSize",40*o+"px")}},{key:"onClick",value:function(t){var e=t.target;t.preventDefault(),e.matches("span")&&e.dataset.ing_codigo&&(e.classList.contains("user-booked")?this.onDispatchTicketEvent(e,"mapUnbookTicket"):this.onDispatchTicketEvent(e,"mapBookTicket"))}},{key:"onDispatchTicketEvent",value:function(t,e){var n=new CustomEvent(e,{detail:{type:3,target:t,ticket:t.dataset.ing_codigo}});document.dispatchEvent(n)}},{key:"onMouseOver",value:function(t){var e=t.target;t.preventDefault();var n=this.containerElement.getBoundingClientRect(),o=t.clientX-n.left,i=t.clientY-n.top;e.matches("div")&&e.dataset.eei_nome&&(this.seatTooltip.textContent="Fileira: ".concat(e.dataset.eei_nome),this.seatTooltip.style.opacity="1",this.seatTooltip.style.left=o+"px",this.seatTooltip.style.top=i-75+"px"),e.matches("span")&&e.dataset.eel_lugar&&(this.seatTooltip.textContent="Fileira: ".concat(e.dataset.eei_nome," - Assento: ").concat(e.dataset.eel_lugar),this.seatTooltip.style.opacity="1",this.seatTooltip.style.left=o+"px",this.seatTooltip.style.top=i-75+"px")}},{key:"onMouseOut",value:function(t){this.seatTooltip.style.opacity="0"}},{key:"set",value:function(t){t&&0!=t.length?(this.seatsRows.innerHTML="",this.seatsList.innerHTML="",this.createSeats(t)):this.modalContent.innerText="Setor não encontrado."}},{key:"show",value:function(){this.element.classList.add("modal-open")}},{key:"hide",value:function(){this.element.classList.remove("modal-open")}},{key:"updateSeat",value:function(t,e){var o,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.seatsList.querySelector('span[data-ing_codigo="'.concat(t,'"]'));r&&((o=r.classList).remove.apply(o,n(r.classList)),r.classList.add(this.seatStatusClass[e]),i&&r.classList.add("user-booked"))}},{key:"createSeats",value:function(t){var e=k(t);for(var n in e){var o=document.createElement("li");o.innerText=n,this.seatsRows.appendChild(o);var i=document.createElement("div");for(var r in i.classList.add("seat-row"),i.dataset.eei_nome=n,e[n]){var s=e[n][r],a=document.createElement("span");a.innerText=s.eel_lugar,a.classList.add(this.seatStatusClass[s.status]||"seat-disabled"),a.dataset.eel_lugar=s.eel_lugar,a.dataset.eei_nome=s.eei_nome,a.dataset.ing_codigo=s.ing_codigo,s.userBooked&&a.classList.add("user-booked"),i.appendChild(a)}this.seatsList.appendChild(i)}}}])}();function k(t){var e=[];return t.forEach(function(t){var n=t.eei_nome;(e[n]||(e[n]=[])).push(t)}),e} },{"./UIComponent":"bdU0"}],"CBJr":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Menu=void 0;var t=require("./UIComponent");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n\n
\n \n \n \n \n \n
\n '),i.buttons=i.element.querySelectorAll(".menu-button"),i.append(!1),b(y,i,e),b(g,i,r),i.defaultWidth=null,i.defaultHeight=null,i}return f(o,t.UIComponent),r(o,[{key:"init",value:function(){var t=this;this.buttons.forEach(function(e){return e.addEventListener("click",t.onMouseClick.bind(t))})}},{key:"onMouseClick",value:function(t){switch(t.currentTarget.dataset.cmd){case"return":var e=new CustomEvent("keydown");e.key="Backspace",document.dispatchEvent(e);break;case"fullscreen":!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement)?(M(),p(g,this).resize(this.defaultWidth,this.defaultHeight)):(this.defaultWidth=p(g,this).width,this.defaultHeight=p(g,this).height,this.containerElement.requestFullscreen(),p(g,this).resize(window.innerWidth,window.innerHeight));break;case"rotate-left":p(y,this).rotateCamera(0,0,180*p(y,this).toRotation.z/Math.PI-45);break;case"rotate-right":p(y,this).rotateCamera(0,0,180*p(y,this).toRotation.z/Math.PI+45);break;case"zoom-in":var n=Math.max(.8,Math.min(p(y,this).toZoom+.1,1.5));p(y,this).zoomCamera(n);break;case"zoom-out":n=Math.max(.8,Math.min(p(y,this).toZoom-.1,1.5));p(y,this).zoomCamera(n)}}}])}();function M(){document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()} },{"./UIComponent":"bdU0"}],"W9P0":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=f;var e=w(require("three")),n=require("./loader"),r=require("./debug"),t=require("../Renderer/renderer"),i=require("../Renderer/camera"),a=require("../Classes/stadium"),o=require("../Controls/mouse"),u=require("../Controls/stadium"),s=require("../Network/dataUpdater"),c=require("../Utils/instersect"),d=require("../UI/tooltip"),l=require("../UI/seatsModal"),p=require("../UI/menu");function w(e,n){if("function"==typeof WeakMap)var r=new WeakMap,t=new WeakMap;return(w=function(e,n){if(!n&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=n?t:r){if(i.has(e))return i.get(e);i.set(e,o)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(a.get||a.set)?i(o,r,a):o[r]=e[r]);return o})(e,n)}function f(e){var w={currentMap:null,mapControl:null},f=document.getElementById(e.canvas);if(!f)throw new Error("Engine - constructor() : Invalid Canvas!");var m=document.getElementById(e.container);if(!m)throw new Error("Engine - constructor() : Invalid container!");var M=new r.Debug,h=new n.Loader,g=new t.Renderer(f),v=new i.Camera(g),y=new d.Tooltip(m,e.showTicketAmount),E=new l.SeatsModal("canvas-container"),q=new p.Menu("canvas-container",v,g),C=new c.Intersects(g.scene,f,v),b=new o.Mouse(v,f,C),I=new s.DataUpdater(e);return w.init=function(){g.setCamera(v),g.init(),v.init(),E.init(),q.init(),e.debug&&M.enable()},w.loadMapFile=function(e){h.loadFile(e,function(e){try{var n=JSON.parse(e)}catch(r){throw new Error("Engine - loadMapFile() : invalid json")}M.write("Engine - Map Loading..."),this.onMapLoad(n)}.bind(this))},w.onMapLoad=function(n){if(!n.type)throw new Error("Engine - onMapLoad(): undefined map type!");switch(n.type){case"stadium":this.currentMap=new a.Stadium(n,e,g,h,I,M),this.mapControl=new u.StadiumControl(this.currentMap,e,v,y,E),M.write("Engine - Map Type - Stadium");break;default:throw new Error("Engine - onMapLoad(): unknown map type!")}I.init(this.currentMap),b.init(this.mapControl),this.mapControl.init(),this.currentMap.init(),M.write("Engine - Initializing map control...")},w} },{"three":"dKqR","./loader":"lL0W","./debug":"bj7I","../Renderer/renderer":"gxPC","../Renderer/camera":"qIvE","../Classes/stadium":"BSLE","../Controls/mouse":"EYkX","../Controls/stadium":"qpzj","../Network/dataUpdater":"Tlfn","../Utils/instersect":"Jdsl","../UI/tooltip":"widE","../UI/seatsModal":"fIWy","../UI/menu":"CBJr"}],"epB2":[function(require,module,exports) { "use strict";var e=r(require("./Core/config")),n=r(require("./Core/engine"));function r(e){return e&&e.__esModule?e:{default:e}}var t=function(){var r=(0,e.default)("fc-map-config");if(r){var t=(0,n.default)(r);try{t.init(),t.loadMapFile(r.map)}catch(o){console.error(o)}}};document.addEventListener("DOMContentLoaded",function(e){t()}); },{"./Core/config":"rB9z","./Core/engine":"W9P0"}]},{},["epB2"], null) //# sourceMappingURL=/main.0e71e00e.js.map